【发布时间】:2015-12-16 15:57:34
【问题描述】:
我正在尝试使用 xampp 发送到 gmail。
我的PHP版本是5.6.8
使用this source 作为指导, 我更改了 php.ini 和 sendmail.ini 的配置,但它对我不起作用。 页面始终显示失败:电子邮件未发送!
这是我的 php:
$to = 'kennybanny12@gmail.com';
$subject = 'No subject';
$message = 'Hello, this is the content of the email.';
$headers = 'From: sticollegesocial@gmail.com';
if(mail($to, $subject, $message, $headers)) {
echo 'Email sent successfully!';
} else {
die('Failure: Email was not sent!');
}
这些是我在 php.ini 中更改的内容:
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = sticollegesocial@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
sendmail.ini:
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=sticollegesocial@gmail.com
auth_password=**********
force_sender=sticollegesocial@gmail.com
【问题讨论】:
-
您的本地主机中有 SMTP 服务器吗??
-
你下载glob.com.au/sendmail了吗??