0
我有一個腳本發送了很多郵件來發送通知,但是由於郵件沒有通過SMTP驗證,郵件直接進入垃圾郵件。我如何製作它以便進行身份驗證?在Linux上使用SMTP Auth發送郵件,Cent OS
我使用下面的腳本:
$to = $email . ', '; // note the comma
// subject
$subject = 'MineAlert - Server Down';
// message
$message = '
<html>
<head>
<title>Your server seems to be down, this could be because it has crashed or you have stopped it</title>
</head>
<body>
<p>Your server seems to be down, this could be because it has crashed or you have stopped it</p>
<p>IP: <b>'.$ip.'</b><br>
<p>Port: <b>'.$port.'</b><br>
<p>Reason: <b>Unknown</b><br>
<br>
This email has been generated and sent to you by
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: [email protected]' . "\r\n";
// Mail it
$mail = mail($to, $subject, $message, $headers);
if (!$mail){
echo "Mail did not send";
} else {
echo "Mail Sent";
}
請注意['mail()'函數](http://www.hardened-php.net/suhosin/configuration.html#suhosin.mail.protect)。 – sarnold