无法从localhost发送邮件

时间:2016-05-31 05:40:21

标签: php email gmail localhost

我无法从localhost发送邮件。我尝试将php.inisendmail.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

0 个答案:

没有答案