中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

解決163/sohu/sina不能夠收到PHP MAIL函數發出郵件的問題

復制代碼 代碼如下:
// multiple recipients
$to = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "/r/n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "/r/n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "/r/n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "/r/n";
$headers .= 'Cc: birthdayarchive@example.com' . "/r/n";
$headers .= 'Bcc: birthdaycheck@example.com' . "/r/n";
// Mail it
mail($to, $subject, $message, $headers);

查看sendmail的maillog,發現奇怪的內容。
復制代碼 代碼如下:
Mar 1 11:28:03 <a title="shaohui" target="_blank">shaohui</a>.org sendmail[27526]: n213S1Xc027524: to=<shaohui_1983@163.com>, ctladdr=<shaohui@shaohui.org> (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 <a title="shaohui" target="_blank">shaohui</a> 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)

根源找到,于是問題就很好解決了,查一下php的手冊,發現mail函數原來也是可以偽造發件人的。
復制代碼 代碼如下:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

在第六個參數additional_parameters使用額外的參數"-f sender_addr@mydomain.com", 問題就解決了。

php技術解決163/sohu/sina不能夠收到PHP MAIL函數發出郵件的問題,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 国产精品一区二区三区在线 | 中文字幕一区二区三区在线观看 | 羞羞视频在线观免费观看 | 亚洲激精日韩激精欧美精品 | 久久毛片 | 欧美日产国产成人免费图片 | 在线视频成人 | 日韩一级 | 亚洲v日韩v综合v精品v | 国产精品一二三区 | 亚洲色欧美另类 | 99资源站 | 黄色成人在线观看 | 一区二区不卡视频 | 国产成人综合一区二区三区 | 99re在线视频免费观看 | 在线观看亚洲专区 | 一区二区三区视频在线 | 先锋av资源在线 | 久久国产高清视频 | 精品在线一区 | 免费一级大片 | 天天搞夜夜操 | 久久国产精品一区二区三区 | 亚洲一区二区在线播放 | 9久久婷婷国产综合精品性色 | 成人午夜免费视频 | 黄色片网站国产 | 四虎成人免费视频 | 亚洲精品久久久久中文字幕二区 | 午夜理伦三级理论三级在线观看 | 永久av| 色综合久久久久 | 成人小视频在线 | 久久国产精品一区二区三区 | 国产成人黄色 | 日韩免费在线观看视频 | 岛国av免费在线观看 | 久久久久久久久久久丰满 | 超碰人人人 | 中文字幕亚洲视频 |