Sendmail Wamp Php [英] Sendmail Wamp Php
问题描述
我已经花了整整一个早晨在互联网上搜索这个,试图找到一个解决方案。
我已经在Windows 8.1上安装了wamp服务器,我试图通过sendmail发送一些邮件( http: //glob.com.au/sendmail/ )和我的Gmail帐户
当我配置sendmail使用端口号465时,我总是得到这个错误:Socket错误#10060Connection超时
如果我尝试使用端口号587,我在错误日志中得到这一行:连接正常关闭。但是没有发送电子邮件。
这是我的sendmail.ini文件
[sendmail]
smtp_server = smtp.gmail.com
;我同时尝试过:587,446
smtp_port = 587
;我试过:blank,auto ssl,tls,none
smtp_ssl =
error_logfile = error.log
debug_logfile = debug.log
auth_username = myaccoun@gmail.com
auth_password = mypass
hostname = localhost
这是php.ini文件
[邮件功能]
smtp_port = 465
sendmail_path =C:\wamp\sendmail\ sendmail.exe -t
mail.add_x_header = On
ssl_module在apache上处于活动状态,并且php使用php_open_ssl和php_socket扩展名。
另外我也试图使用stunnel whitout任何成功
编辑27 / 01/2014
我在sendmail.ini上设置smtp_port = 465和smtp_ssl = ssl。此外,我设置sendmail.exe必须作为Windows XP SP3程序运行。这样做后,当我在Windows控制台上运行sendmail.exe时,它会正确发送电子邮件。但是,当wamp尝试发送邮件时,我在sendmail的错误日志中收到此错误:Socket错误#10060Connection超时。
这是我用来测试的代码sendmail:
<?php
$ email =mymail@gmail.com;
$ to =mymail@gmail.com;
$ subject =嗨!;
$ body =你好吗?
$ headers ='From:'。$ email。 \r\\\
。回覆:。 $电子邮件。 \r\\\
。'X-Mailer:PHP /'。 phpversion();
if(mail($ to,$ subject,$ body,$ headers))echo(< p>电子邮件成功发送< / p>);
else echo(< p>电子邮件传送失败< / p>);
?>
最后我找到答案。 b
$ b
问题是sendmail必须作为管理员运行。
- 右键单击sendmail.exe
- 属性
- 兼容性
- 更改所有用户的配置
- 执行为Windows XP SP 3
-
- 执行adminitrator
然后保存:D
这个废话丢了两天:(
I have spent all the morning searching this on internet trying to find a solution about this. I have installed wamp server on Windows 8.1 and i'm trying to send some mails with sendmail (http://glob.com.au/sendmail/) and my gmail account
When i configure sendmail to use port nº 465 I always get this error: Socket Error # 10060Connection timed out
If i try to use port nº 587 i get this line on error log: Connection Closed Gracefully. But no email is sent.
This is my sendmail.ini file
[sendmail]
smtp_server=smtp.gmail.com
;I tried both: 587, 465
smtp_port=587
; I tried: "blank, auto ssl, tls, none"
smtp_ssl=
error_logfile=error.log
debug_logfile=debug.log
auth_username=myaccoun@gmail.com
auth_password=mypass
hostname=localhost
And this is php.ini file
[mail function]
smtp_port = 465
sendmail_path="C:\wamp\sendmail\sendmail.exe -t"
mail.add_x_header = On
ssl_module is active on apache, and php uses php_open_ssl and php_socket extension.
Also i tried to use stunnel whitout any success
EDIT 27/01/2014
I set smtp_port = 465 and smtp_ssl=ssl on sendmail.ini. Also, I set that sendmail.exe has to run as a Windows XP SP3 programs. After doing that, when I run sendmail.exe on windows console, it sends the email correctly. However, when wamp tries to send mails i get this error on sendmail's error logs.: Socket Error # 10060Connection timed out.
This is the code I'm using to test sendmail:
<?php
$email = "mymail@gmail.com";
$to = "mymail@gmail.com";
$subject = "Hi!";
$body = "Hi,How are you?";
$headers = 'From: ' .$email . "\r\n".'Reply-To: ' . $email. "\r\n".'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $body, $headers)) echo("<p>Email successfully sent</p>");
else echo("<p>Email delivery failed</p>");
?>
Finally I found the answer.
The problem is that sendmail has to be run as an administrator. This is the solution to help any one on my situation.
- Right click on sendmail.exe
- Properties
- Compatibility
- Change the configuration for all users
- Execute as Windows XP SP 3
- Execute as adminitrator
And save :D
2 days lost in this nonsense :(
这篇关于Sendmail Wamp Php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!