我有这个邮件功能可以正常工作,除了它总是到达外观“垃圾”。
我可以更改任何内容以使其到达“收件箱”吗?
此外,我不确定它是否相关,但有时需要一些时间才能到达,有时它似乎没有到达?
代码:
$subject = 'subject';
$message = 'testingyesyes';
$to = 'mail@chrismepham.com';
$type = 'plain'; // or HTML
$charset = 'utf-8';
$mail = 'no-reply@'.str_replace('www.', '', $_SERVER['SERVER_NAME']);
$uniqid = md5(uniqid(time()));
$headers = 'From: '.$mail."\n";
$headers .= 'Reply-to: '.$mail."\n";
$headers .= 'Return-Path: '.$mail."\n";
$headers .= 'Message-ID: <'.$uniqid.'@'.$_SERVER['SERVER_NAME'].">\n";
$headers .= 'MIME-Version: 1.0'."\n";
$headers .= 'Date: '.gmdate('D, d M Y H:i:s', time())."\n";
$headers .= 'X-Priority: 1'."\n";
$headers .= 'X-MSMail-Priority: High'."\n";
$headers .= 'Content-Type: multipart/mixed;boundary="----------'.$uniqid.'"'."\n\n";
$headers .= '------------'.$uniqid."\n";
$headers .= 'Content-type: text/'.$type.';charset='.$charset.''."\n";
$headers .= 'Content-transfer-encoding: 7bit';
mail($to, $subject, $message, $headers);
由于