Xampp php不发送电子邮件

时间:2014-03-09 15:31:27

标签: php email

我正在尝试让php通过我的xampp发送测试邮件,我知道我必须配置php.inc文件和sendmail文件才能让xampp发送电子邮件。

但即使在这之后我还是无法发送电子邮件

继承了两个文件的修改代码片段

php.inc

[ mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
 SMTP = smtp.gmail.com
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = {email}@gmail.com

; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g.     c:\program filesC:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.  
 ; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"

sendmail.ini(我在文件底部添加了这个)

    ;new config:
 smtp_server=smtp.gmail.com
 smtp_port=587
smtp_ssl=tls
error_logfile=error.log
pop3_server=
pop3_username=
pop3_password=
force_recipient=
hostname=

auth_username={email}@gmail.com
auth_password={mypass }
 force_sender={email}@gmail.com

为什么这种配置不起作用的任何想法?

3 个答案:

答案 0 :(得分:0)

据我所知,您无法使用xampp或mampp等直接从本地计算机发送电子邮件。

您需要将脚本部署到具有电子邮件网关的服务器。

答案 1 :(得分:0)

您可以使用Mamp直接发送电子邮件,但不能使用Xampp。我现在正在使用Mamp。如果您使用Windows,请尝试使用wamp。

答案 2 :(得分:0)

是的,您可以通过G-mail帐户执行此操作:

Host =“ssl://smtp.gmail.com”; $ mail-> Port = 465;

XAMPP Sendmail using Gmail account