编辑:
使用PHPmailer发送电子邮件的基本思路非常完美。但我有问题附加文件(不同)格式。
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.domain.com"; // SMTP server
$mail->From = "frommail@domain.com";
$mail->FromName="fromname";
$mail->AddAddress("admin@domain.com");
$mail->IsHTML(true);
//for file attachments
$mail->AddAttachment($_FILES['uploaded_file']['tmp_name'], $_FILES['uploaded_file']['name']);
$mail->Subject = "First PHPMailer Message";
$mail->Body = "<b>Hi! <br><br> This is my first e-mail sent through PHPMailer.</b>";
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
//$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
我试图显示序列但不是帮助。非常感谢您的时间。