duanlun4411 2014-01-24 16:39
浏览 44
已采纳

Sendmail Wamp Php

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 . "
".'Reply-To: ' . $email. "
".'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $body, $headers)) echo("<p>Email successfully sent</p>");
else echo("<p>Email delivery failed</p>");
?>
  • 写回答

4条回答 默认 最新

  • dongtazu3080 2014-01-27 12:04
    关注

    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.

    1. Right click on sendmail.exe
    2. Properties
    3. Compatibility
    4. Change the configuration for all users
    5. Execute as Windows XP SP 3
    6. Execute as adminitrator

    And save :D

    2 days lost in this nonsense :(

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 Arcgis相交分析无法绘制一个或多个图形