我的脚本工作正常,因为它显示“已发送消息!” 但没有收到指定电子邮件的电子邮件。顺便说一句,使用 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.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
发送邮件.ini:
smtp_server=smtp.mail.yahoo.com
; smtp port (normally 25)
smtp_port=25
auth_username=theaccount+yahoo.com
auth_password=passwordhere