我正在尝试发送和电子邮件文本或/和 html 版本..
我要做的是:
$bodyHTML = "
--PHP-alt-$random_hash
Content-Type: text/plain; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
http://example.com/app_dl.php?app_id=$_GET[app_id] to download your $app_name app \n\r
Want to get tons more hot apps for free! anywhere anytime? Download our app on http://example' \n\r\n\r
example.com team
--PHP-alt-$random_hash
Content-Type: text/html; charset='iso-8859-1'
Content-Transfer-Encoding: 7bit
<p><a href='http://example.com/app_dl.php?app_id=$_GET[app_id]'>Click Here</a> to download your $app_name app</p>
<p>Want to get tons more hot apps for free! anywhere anytime? Download our app on <a href='http://example.com'>example.com</a></p>
<br/>
<p>example.com team</p>
--PHP-alt-$random_hash ";
endif;
这就是我得到的:
--PHP-alt-f4b83c7072ae970392b44308a6c36109 Content-Type: text/plain; charset='iso-8859-
1' Content-Transfer-Encoding: 7bit http://example.com/app_dl.php?app_id=35 to download your PhoneMates app Want to get tons more hot apps for free! anywhere anytime? Download our app on http://example.com' example.com team --PHP-alt-f4b83c7072ae970392b44308a6c36109 Content-Type: text/html; charset='iso-8859-1' Content-Transfer-Encoding: 7bit
Click Here to download your PhoneMates app
Want to get tons more hot apps for free! anywhere anytime? Download our app on example.com
example.com team
--PHP-alt-f4b83c7072ae970392b44308a6c36109
问题是我看到所有这些标题行..内容类型..并且文本行无法使用 '\n\r'..
另外不知道能不能达到一个版本失败..html或者txt,然后出现另一个版本..谢谢帮助
这是一些代码:
$random_hash = md5(date('r', time()));
$boundary="PHP-alt-".$random_hash;
$headers = array ('From' => $from,
'Content-Type'=> 'multipart/alternative',
'boundary'=>$boundary,
'To' => $to,
'Return-Path' => 'info@example.com',
'Subject' => $subject);
其他详细信息,例如发件人,通行证,标题,不相关..所以我没有在这里展示它们..