// multiple recipients
$to = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
Birthday Reminders for August Here are the birthdays upcoming in August!
Person | Day | Month | Year |
Joe | 3rd | August | 1970 |
Sally | 17th | August | 1973 |
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
// Additional headers
$headers .= 'To: Mary
, Kelly ' . "rn";
$headers .= 'From: Birthday Reminder ' . "rn";
$headers .= 'Cc: birthdayarchive@example.com' . "rn";
$headers .= 'Bcc: birthdaycheck@example.com' . "rn";
// Mail it
mail($to, $subject, $message, $headers);
Mar 1 11:28:03
shaohui.org sendmail[27526]: n213S1Xc027524: to=
, ctladdr= (500/500), delay=00:00:02, xdelay=00:00:01, mailer=esmtp, pri=150812, relay=163mx03.mxmail.netease.com. [220.181.12.72], dsn=5.0.0, stat=Service unavailable
但是,如果我使用Linux Shell 的mail命令是可以发送成功的,不过多加了一条-f 参数伪造发件人。这是唯一的不同,于是maillog 的其中一个字段ctladdr显示也不一样。不再是apache用户,我怀疑163等国内的邮件服务提供商,把所有的apache的用户的邮件当成垃圾邮件处理掉了。
Feb 25 23:44:59
shaohui sendmail[13067]: n1PFixH4013067: to=shaohui_1983@163.com, ctladdr=contact@shaohui.org (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30869, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n1PFixdx013068 Message accepted for delivery)