我是php新手,我正在尝试发送确认电子邮件:
public static function sendAuthenticationEmail($username, $email, $uuid) {
$subject = "Register email address";
$headers = 'MIME-Version: 1.0' . PHP_EOL .
'Content-type: text/html; charset=iso-8859-1' . PHP_EOL .
'To: ' . $username . ' <' . $email . '>' . PHP_EOL .
'From: whereisthemonkey <noreply@whereisthemonkey.me>' . PHP_EOL .
'X-Mailer: PHP/' . phpversion();
$link = 'http://localhost/Whereisthemonkey/FileSystem/EmailSystem.php?email=' .
$email . '&uuid=' . substr($uuid, 0, 14);
$message = '
<html>
<head>
<title>Email authentication</title>
</head>
<body style="color: #000080">
<p style="font-weight: bold; color: #990000">Do not reply to the email!</p>
<p>Hey ' . $username . ', this email has recently been used as authentication on <b>Whereisthemonkey</b>!<br><br>
If that was you, please click
<a href="' . $link . '">here</a><br><br>
<p>If that was not you, please just ignore this email!</p>
<p>Have a nice day, the whereisthemonkey team!
</body>';
return mail($email, $subject, $message, $headers);
}
邮件已发送,但从未到达服务器(在本例中为gmail)。
我做错了什么?
非常感谢, 卢卡斯!