PHP邮件功能停止工作

时间:2018-06-15 14:06:41

标签: php email

我有以下部分代码可以正常工作但突然间它从今天开始无法正常工作(邮件未送达)。我对此有所了解,并没有找到任何合适的答案。

 $content = chunk_split(base64_encode($mpdf->Output($file.'.pdf', 'S')));

 $separator = md5(time());

 $eol = PHP_EOL;

 $headers = "From: ".$fromemail['Fromemail'] . $eol;
 $headers .= "Cc: ".$ccemail['Email'] . $eol;
 $headers .= "Importance: High\n"; 
 $headers .= "MIME-Version: 1.0".$eol; 
 $headers .= "Content-Type: multipart/mixed;boundary=\"" . $separator . "\"".$eol.$eol;


 // message
 $body .= "Content-Transfer-Encoding: 7bit".$eol;
 $body .= "This is a MIME encoded message.".$eol;
 $body = "--" . $separator.$eol;
 $body .= "Content-Type: text/html; charset=\"UTF-8\"".$eol;
 $body .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
 $body .= $message.$eol;

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

 //SEND Mail
 if (mail($mailto, $subject, $body, $headers)) {
         //echo "mail send ... OK"; // or use booleans here
  } 

请让我知道我走向错误的方向。

0 个答案:

没有答案