【发布时间】:2016-08-02 10:07:52
【问题描述】:
下面是我的电子邮件发送脚本的代码,一年了同样的代码运行良好,但现在它没有发送任何电子邮件,请帮我解决这个错误
消息:mail():在 Additional_header 中发现多个或格式错误的换行符
$encoded_content = chunk_split( base64_encode( $variables['pdfFileContents'] ));
$uid = md5( time() );
$fileName = str_replace( " ", "_", $variables['emailContains'] );
$fileName .= ".pdf";
////// attachment header ///////////////////////////////
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "From: cashxcash.com<{$sender}>";
$headers[] = "Content-Type: multipart/mixed; boundary=\"{$uid}\"";
$headers[] = "This is a multi-part message in MIME format.";
$headers[] = "--{$uid}";
$headers[] = "Content-type:text/plain; charset=iso-8859-1"; // Set message content type
$headers[] = "Content-Transfer-Encoding: 7bit";
$headers[] = ""; // Dump message
$headers[] = "--{$uid}";
$headers[] = "Content-Type: application/octet-stream; name=\"{$fileName}\""; // Set content type and file name
$headers[] = "Content-Transfer-Encoding: base64"; // Set file encoding base
$headers[] = "Content-Disposition: attachment; filename=\"{$fileName}\""; // Set file Disposition
$headers[] = $encoded_content; // Dump file
$headers[] = "--{$uid}--"; //End boundary
return mail(
$reciever,
"{$variables['emailContains']} Report from Cashxcash!",
"",
implode("\r\n", $headers)
);
【问题讨论】:
标签: php codeigniter