PHP XAMPP mail() 已发送,但未投递到邮箱
PHP XAMPP mail() sent, but not delivered to mailbox
我在 PHP 中的 mail() 函数有问题。我正在使用 XAMPP。这是我的配置文件:
php.ini
[mail function]
SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = my_mail@gmail.com
sendmail_path = C:\xampp\sendmail\sendmail.exe\
sendmail.ini (C:\xampp\sendmail\sendmail.ini)
[sendmail]
smtp_server = smtp.gmail.com
smtp_port = 587
error_logfile = error.log
debug_logfile = debug.log
auth_username = my_mail@gmail.com
auth_password = my_password
force_sender = my_mail@gmail.com
这是我的代码:
<?php
$to= "another_mail@gmail.com";
$subject = "Title";
$messages= "Lorem ipsum dolor sit amet.";
if( mail($to, $subject, $messages) ) {
echo "Email sent!";
} else {
echo "Not sent!";
}
?>
程序正在返回 电子邮件已发送! 消息,但邮件没有投递到我的邮箱。我已经尝试将 php.ini 和 sendmail.ini 中的端口更改为 465,但没有任何改变。
你有什么想法吗?
编辑:
我想,我已经找到了我的 php 日志。它是波兰语(我的系统默认语言),所以翻译可能不完美 - 对此感到抱歉。这是:
Unable to find description for Event ID 2 from PHP-7.4.6 source. Either the component causing this event is not installed on the local computer or the installation is damaged. You can install or repair the component on your computer.
If the event is from a different computer, you may need to save the display information along with the event.
The following information was attached to the event:
php
mail () on [C: \ xampp \ htdocs \ mail.php: 8]: To: another_mail@gmail.com - Headers: - Subject: Title
A message resource is present, but this message was not found in the message table
你现在有什么想法了吗?怎么了?
我知道了!现在可以使用了!
我必须转到 myaccount.google.com > 安全性 并设置 2 步验证,然后生成应用程序密码(对于 xampp)。
感谢这个视频,我做到了:https://www.youtube.com/watch?v=L5uCc8Hab-I
谢谢!
我在 PHP 中的 mail() 函数有问题。我正在使用 XAMPP。这是我的配置文件:
php.ini
[mail function]
SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = my_mail@gmail.com
sendmail_path = C:\xampp\sendmail\sendmail.exe\
sendmail.ini (C:\xampp\sendmail\sendmail.ini)
[sendmail]
smtp_server = smtp.gmail.com
smtp_port = 587
error_logfile = error.log
debug_logfile = debug.log
auth_username = my_mail@gmail.com
auth_password = my_password
force_sender = my_mail@gmail.com
这是我的代码:
<?php
$to= "another_mail@gmail.com";
$subject = "Title";
$messages= "Lorem ipsum dolor sit amet.";
if( mail($to, $subject, $messages) ) {
echo "Email sent!";
} else {
echo "Not sent!";
}
?>
程序正在返回 电子邮件已发送! 消息,但邮件没有投递到我的邮箱。我已经尝试将 php.ini 和 sendmail.ini 中的端口更改为 465,但没有任何改变。
你有什么想法吗?
编辑:
我想,我已经找到了我的 php 日志。它是波兰语(我的系统默认语言),所以翻译可能不完美 - 对此感到抱歉。这是:
Unable to find description for Event ID 2 from PHP-7.4.6 source. Either the component causing this event is not installed on the local computer or the installation is damaged. You can install or repair the component on your computer.
If the event is from a different computer, you may need to save the display information along with the event.
The following information was attached to the event:
php
mail () on [C: \ xampp \ htdocs \ mail.php: 8]: To: another_mail@gmail.com - Headers: - Subject: Title
A message resource is present, but this message was not found in the message table
你现在有什么想法了吗?怎么了?
我知道了!现在可以使用了!
我必须转到 myaccount.google.com > 安全性 并设置 2 步验证,然后生成应用程序密码(对于 xampp)。
感谢这个视频,我做到了:https://www.youtube.com/watch?v=L5uCc8Hab-I
谢谢!