簡體   English   中英

無法使用PHP將電子郵件發送到Yahoo電子郵件

[英]Unable to send email to yahoo email using PHP

我的腳本工作正常,因為它顯示“消息已發送!” 但未收到指示電子郵件。 使用XAMPP btw。 感謝幫助。 謝謝。

<?php
$to = 'theaccount@yahoo.com';
$subject = 'Sample Subject';
$message = 'Hi. This is a sample message.';
$headers = 'From: webmaster@august.ai.com' . "\r\n" .
    'Reply-To: no-reply@august.ai.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

echo (mail($to, $subject, $message, $headers)) ? 'Message sent!' : 'Message not sent!';
?>

這是我的php.inisendmail.ini中的信息

php.ini

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = theaccount@yahoo.com
; smtp_port = 25

sendmail.ini

smtp_server=smtp.mail.yahoo.com

; smtp port (normally 25)

smtp_port=25

auth_username=theaccount+yahoo.com      
auth_password=passwordhere

您尚未“注釋掉” php.ini的SMTP配置行:

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = theaccount@yahoo.com
; smtp_port = 25

對於php.ini文件,使用分號; 用於評論。 因此,您需要將其從這些行中刪除:

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = theaccount@yahoo.com
smtp_port = 25

試試看:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM