无法使用PHP向yahoo电子邮件发送电子邮件

时间:2013-09-15 06:10:47

标签: php email xampp yahoo

我的脚本显示“消息已发送!”但是没有收到指定电子邮件的电子邮件。使用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.ini sendmail.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

1 个答案:

答案 0 :(得分:0)

您尚未“注释掉”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

尝试一下:)