我的脚本显示“消息已发送!”但是没有收到指定电子邮件的电子邮件。使用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
答案 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
尝试一下:)