mail()
我想通过该功能发送电子邮件。
mail($to,$subject,$message)
工作正常。
但是使用mail($to,$subject,$message,$header)
不起作用。标题是:
Date: Tue, 2 Jul 2013 15:01:49 +0200 +0200
Return-Path: noreply@myhost.com
From: "noreply@myhost.com"
Message-ID:
X-Priority: 3
X-Mailer: PHPMailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/html; charset=UTF-8
我的标题有什么问题?仅供参考,标头由 PHPMailer 生成。我用来发送它的代码是:
$mail = new PHPMailer();
$mail->IsMail();
$mail->From = $from;
$mail->FromName = $from;
$mail->AddAddress($to);
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->Subject = $subject;
$mail->Body = $message;
$mail->Send();