如何使用php mail()使用附件在php中发送邮件

时间:2017-05-23 06:01:07

标签: php

我遇到错误,例如'PHP警告:mail():在additional_header中找到多个或格式错误的换行符

我写得像 -

$message="<html><body>";
$message.= "<table width='100%' border='0'><tr><td>Dear</td></tr>
            <tr><td>Thanks for the Enquiry</td></tr>";  
$message.="</table></body></html>";
$header = "From: $email_from\r\n";
$header .= "CC:sales@arrowpackers.co.in\n";
$header .= "Reply-To:sales@arrowpackers.co.in\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/pdf; name=\"".$fileatt_name."\"\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment;filename=\"".$fileatt_name."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
$ok=mail($email_to,$email_subject,$message,$header);

0 个答案:

没有答案