我无法从localhost发送邮件。我尝试将php.ini
和sendmail.ini
的配置更改为下面提到的两个文件的代码。
这是我在php文件中的邮件功能。
if (mail("exmaplesend@test.pk", "this is subject", "this is testing message", "From:example@gmail.com")) {
echo 'Email sent successfully!';
} else {
die('Failure: Email was not sent!');
}
这是php.ini
配置:
SMTP=localhost
SMTP =smtp.gmail.com
smtp_port =587
sendmail_from =example@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
和Sendmail.ini代码在这里:
account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from [example]@gmail.com
auth on
user [example]@gmail.com
password [**********]
port 587
account default : Gmail