PHPMailer收件箱中的奇怪标题信息

时间:2014-05-28 13:04:06

标签: php email phpmailer

如果我想用PHPMailer发送邮件,它可以工作,但不如我预期的那么好,希望有人有解决方案。

来自姓名&电子邮件已填写,但在我的邮箱中显示如下: enter image description here

现在我用这个脚本发送邮件,但我不知道我做错了什么

$email = new PHPMailer();
$email->From      = 'you@example.com';
$email->FromName  = 'Your Name';
$email->Subject   = 'Message Subject';
$email->Body      = $bodytext;
$email->AddAddress( 'destinationaddress@example.com' );

$file_to_attach = 'PATH_OF_YOUR_FILE_HERE';

$email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' );

return $email->Send();

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我认为你的语法错误了。试试这个:

$email->setFrom('from@example.com', 'First Last');

https://github.com/Synchro/PHPMailer/blob/master/examples/sendmail.phps