PHPMailer邮件标题

时间:2012-12-12 13:28:07

标签: php sendmail phpmailer

我使用PHPMailer发送电子邮件。但由于某种原因,它总是去垃圾箱..

Google表示该电子邮件缺少邮寄标题

问题是如何使用PHPMailer添加额外的标头?

current code:
function sendMail($mail, $arr) {
    $mail->AddAddress($arr['toEmail'], $arr['toName']);
    $mail->SetFrom($arr['fromEmail'], $arr['fromName']);
    $mail->AddReplyTo($replyEmail, $replyName);
    $mail->Subject = trim($arr['subject']);
    $mail->addCustomHeader('mailed-by: mydomain.com'); <-- didnt work.
    $mail->MsgHTML( trim($arr['content']) );
    $mail->IsHTML(true); 
    $mail->Send();
}

2 个答案:

答案 0 :(得分:1)

根据此documentation,可以尝试:$mail->Hostname

答案 1 :(得分:-1)

已经尝试过了吗?:

$mail->Host = "mydomain.com";