【发布时间】:2015-04-16 10:27:15
【问题描述】:
我正在尝试通过我的 gmail 帐户在 Windows 中发送邮件,我已经配置了我的 php.ini :
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from=jaisanas2@gmail.com
sendmail_path="\"C:\xampp\sendmail\sendmail.exe\" -t"
and sendmail.ini :
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
auth_username=confidential@gmail.com
auth_password=my-password-confident
force_sender=confidential@gmail.com
这是我的代码:
<?php
// The message
$message = "Line 1\r\nLine 2\r\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");
// Send
$send = mail('jaisanas2@gmail.com', 'My Subject', $message);
if ($send) {
echo "send";
}
else {
echo "fail";}
?>
我也改变了我的谷歌安全变得不那么安全 我不知道为什么,有人帮帮我吗?
【问题讨论】:
-
您没有转义
sendmail_path中的反斜杠。这对我来说看起来不对。 -
还是失败了,我改成sendmail_path="\"C:\\xampp\\sendmail\\sendmail.exe\" -t"
-
我想知道本地服务器是否可以与在线服务器交互。对我来说是新的
-
我不认识 Jean Gkol,但它看起来适合某些人stackoverflow.com/questions/15965376/…
-
大多数情况下,您无法从本地服务器发送邮件,您需要将文件上传到实时服务器。
标签: php xampp sendmail sendmail.exe