0
我嘗試使用PHPMailer的,在這裏我的代碼發送電子郵件:如何使用PHPMailer和localhost SMTP將郵件發送到Gmail?
require '/PHPMailer-master/PHPMailerAutoload.php';
$mailltoadm = new PHPMailer;
$mailltoadm->isSMTP();
$mailltoadm->Host = 'localhost';
$mailltoadm->SMTPAuth = true;
$mailltoadm->Username = '[email protected]';
$mailltoadm->Password = 'mypasswordhere';
$mailltoadm->SMTPSecure = 'tls';
$mailltoadm->From = $emaillogin;
$mailltoadm->FromName = $userloginname;
$mailltoadm->addAddress($mastermaill, $name_store);
$mailltoadm->addAddress($mastermaill);
$mailltoadm->addReplyTo($emaillogin, $userloginname);
$mailltoadm->WordWrap = 50;
$mailltoadm->isHTML(true);
$mailltoadm->Subject = 'New Order '. $name_store;
$mailltoadm->Body = $finishorder;
$mailltoadm->AltBody = convert_html_to_text($finishorder);
if(!$mailltoadm->send())
{
echo 'Mailer to admin Error: ' . $mailltoadm->ErrorInfo;
}
else
{
echo 'Message to admin has been sent';
}
爲什麼郵件發送到@ yahoo.com的成功,但不能發送到@ gmail.com?
任何人都可以幫助我。
爲什麼你的問題的所有文字都是粗體的? – AD7six
您是否在PHP或SMTP服務器日誌中收到任何錯誤消息? Google的服務器很可能會拒絕有關垃圾郵件或類似理由的郵件。 – IMSoP
你確定你能夠發送郵件從本地主機到yahoo.com – user3091574