PHP邮件() - 无法从本地主机发送邮件到Gmail(xampp)

问题描述:

对于一个学校项目,我需要将电子邮件从本地主机发送到Gmail。 我已经下载并复制了http://glob.com.au/sendmail/中的所有文件,并将它们粘贴到我的xampp/sendmail文件夹中。PHP邮件() - 无法从本地主机发送邮件到Gmail(xampp)

这是我的设置应该在技术上的工作。

sendmail.ini:

smtp_server=smtp.gmail.com 
smtp_port=587 
smtp_ssl=auto 
[email protected] 
auth_password=mypassword 

的php.ini:

sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" 
;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe" 
; SMTP = localhost 
; smtp_port = 25 
+0

可能重复的[如何配置XAMPP从本地主机发送邮件?](http://*.com/questions/15965376/how-to-configure-xampp-to-send-mail-from-localhost ) –

  1. 确保以管理员身份运行sendmail.exe并在兼容模式“Windows XP(Service Pack 3)”中运行。右键单击 - >属性 - >兼容性。
  2. 然后访问以下链接https://www.google.com/settings/security/lesssecureapps并接受。否则Gmail会阻止传入的请求。

如果您使用的XAMPP,您可以检查这个答案: [How to configure XAMPP to send mail from localhost?

或者你可以使用phpmailler而不是这种方法。