0

我的脚本工作正常,因为它显示“已发送消息!” 但没有收到指定电子邮件的电子邮件。顺便说一句,使用 XAMPP。感谢帮助。谢谢你。

<?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

发送邮件.ini

smtp_server=smtp.mail.yahoo.com

; smtp port (normally 25)

smtp_port=25

auth_username=theaccount+yahoo.com      
auth_password=passwordhere
4

1 回答 1

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

试试看:)

于 2013-09-15T06:34:15.690 回答