mail():在将服务器Plex更改为Cpanel后,在additional_header错误中发现多个或格式错误的换行符

时间:2017-04-22 09:58:31

标签: php email header

我发送附带pdf文件的电子邮件。当我使用plex面板下面代码工作正常现在我用Cpanel更新这个脚本无法正常工作。上面是电子邮件的代码。请帮我做什么。

我发送附带pdf文件的电子邮件。当我使用plex面板下面代码工作正常现在我用Cpanel更新这个脚本无法正常工作。上面是电子邮件的代码。请帮我做什么。

$to = $email.",billing@hotelsinkonkan.in"; 
$from = "billing@hotelsinkonkan.in"; 
$subject ="Instant e-Bill from www.hotelsinkonkan.in for ".$hotel_name; 


$message ="<html><head></head><body style='font-family:Calibri; font-size:11pt; line-height:18px; color:#403437;'>";

$message .="Dear ".$contact.",<br/><br/>";

$message.="<p style='font-size:15px; color:#215868' >Thank you for being our Valued Customer and for using Instant e-Bill service.!</p>";

$message.="We are pleased to present your e-Bill for Advertise on www.hotelsinkonkan.in dated <strong>".date("d-m-y")."</strong> for the period ".$st_date1.' To '.$ed_date1."<br/>";

$message.="<p style='font-size:15px; color:#215868'>We value your relationship with us and assure you our best services at all times.</p>";

$message .="Thanks And Regards<br/>
Billing Hotels In Konkan<br/>
(Active Bit Technologies)<br/>";

$message.="<img style='margin:10px 0px 10px 0px;' src='http://hotelsinkonkan.in/admin/images/logo_mail.jpg'/><br/>";

$message .="Address - Dhayari Industrial Estate,<br/>
Near Pari Automation, Starling<br/>
Nisarga Phase ||, Dhayari<br/><br/>";

$message .="<p style='color:#292727'>Phone no : +91 020 - 32326630</p>";

$message .="<p>Website   : www.hotelsinkonkan.in<br/>";
$message .="Email : billing@hotelsinkonkan.in</p>";

$message .="Click Here to Download Hotels in Konkan <a href='http://slideme.org/application/hotelsinkokan'>Apps on Your Mobile</a><br/>"; 

$message.="<img style='margin:10px 0px 6px 0px;' src='http://hotelsinkonkan.in/admin/images/mail.jpg'/><br/>";

$message.="MPORTANT NOTICE:<br/>
Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender, does not accept liability for any errors or omissions. Active Bit Technologies does not accept liability of mishandling of email account. The information in this email (and any attachments) is confidential. If you are not the intended recipient, you must not use or disseminate this information. If you have received this email in error, please immediately revert to support@activebittechnologies.com  and permanently delete the original and any copies or printouts thereof. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Active Bit Technologies. or their subsidiaries or affiliates either jointly or severally, for any loss or damage arising in any way from its use.";

$message .="</body></html>";

 echo $message;
$separator = md5(time());

$eol = PHP_EOL;

$filename =$pdf_name.".pdf";

$pdfdoc = $pdf->Output("", "S");
$attachment = chunk_split(base64_encode($pdfdoc));



$headers  = "From: ".$from.$eol;
$headers .= "MIME-Version: 1.0".$eol; 
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol; 
$headers .= "Content-Transfer-Encoding: 7bit".$eol;
$headers .= "This is a MIME encoded message.".$eol.$eol;



$headers .= "--".$separator.$eol;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$headers .= $message.$eol.$eol;


$headers .= "--".$separator.$eol;
$headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol; 
$headers .= "Content-Transfer-Encoding: base64".$eol;
$headers .= "Content-Disposition: attachment".$eol.$eol;
$headers .= $attachment.$eol.$eol;
$headers .= "--".$separator."--";


mail($to, $subject, "", $headers);

0 个答案:

没有答案