sendmail.exe在发送邮件时打开 [英] sendmail.exe opens on sending mail

查看:240
本文介绍了sendmail.exe在发送邮件时打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我使用sendmail是新手,但我已经阅读了很多关于这方面的内容,只重定向到使用PHPmailer,swiftmailer等等......但是如果没有基础知识,理解起来会非常复杂。所以我决定尝试简单的,这就是我已经得到的。



我已经配置了我的php.ini:

  [邮件功能] 
smtp_port = 465
sendmail_path =C:\wamp\sendmail\sendmail.exe -t
mail.add_x_header = On

和我的sendmail.ini:

  [sendmail] 
smtp_server = smtp.gmail.com
smtp_port = 587
smtp_ssl =
error_logfile =错误。 log
debug_logfile = debug.log
auth_username=mygmail@gmail.com
auth_password = mypassword
hostname = localhost

我有这个PHP代码:

  $ to ='mygmail @ gmail.com; 
$ message = $ _POST ['message'];
$ email = $ _POST ['email'];
$ contact_num = $ _POST ['contact_number'];
$ headers ='发件人:'。'$ email'。 \r\\\
,$ contact。 \r\\\

'回复:mygmail@gmail.com'。 \r\\\

'X-Mailer:PHP /'。 phpversion();

邮件($ to,$ message,$ headers);

但是当我点击提交按钮时,sendmail.exe就会出现并且什么也没有发生。当我检查error.log时,它会说:

  14/07/01 23:23:48:连接正常关闭。 


解决方案

这部分是复制&贴上贴: Sendmail Wamp PHP



问题是sendmail必须以管理员身份运行。这是解决方案,以帮助任何人对我的情况。


  1. 右键单击sendmail.exe

  2. 属性

  3. 兼容性

  4. 更改所有用户的配置

  5. 作为Windows XP SP 3执行
  6. li>
  7. 以管理员身份执行



    如果您使用gmail,则需要创建新密码您的
    应用程序专用密码


  8. $ b b
    $ b

    确保服务器(或IDE)以管理员身份运行,方法如下:1)右键单击程序(例如,服务器,ide,命令提示符),然后点击以管理员身份运行



    2)或右键单击程序>属性>兼容性>以管理员身份执行$

    例如,如果您在构建的服务器中使用PHP,请以admin身份运行命令提示符并按照正常方式启动服务器。

      C:\wamp\bin\php\php5.5。 12 \php.exe -S localhost:80 -t C:\Users\path\to\rootFolder 

    当然可以根据需要更改文件路径。

    编辑:这可能是您进入 https://bugs.php.net/bug.php?id=44994


    I am actually new in using sendmail but I have read a lot about this, and only redirect me to use PHPmailer,swiftmailer etc... But it's so complicated to understand without the knowledge of the basics. So I decided to try simple, and this is what I've got.

    I have configured my php.ini:

    [mail function]
    smtp_port = 465
    sendmail_path="C:\wamp\sendmail\sendmail.exe -t"
    mail.add_x_header = On
    

    And my sendmail.ini:

    [sendmail]
    smtp_server=smtp.gmail.com
    smtp_port=587
    smtp_ssl=
    error_logfile=error.log
    debug_logfile=debug.log
    auth_username=mygmail@gmail.com
    auth_password=mypassword
    hostname=localhost
    

    and I have this PHP code:

    $to      = 'mygmail@gmail.com';
    $message = $_POST['message'];
    $email = $_POST['email'];
    $contact_num = $_POST['contact_number'];
    $headers = 'From:'.'$email' . "\r\n" .'$contact' . "\r\n" .
    'Reply-To: mygmail@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
    
    mail($to, $message, $headers);
    

    but whenver i click the submit button the sendmail.exe appears and nothing happens. And when I check the error.log it says:

    14/07/01 23:23:48 : Connection Closed Gracefully.
    

    解决方案

    This part is a copy & paste of post: Sendmail Wamp Php

    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

      if you using gmail you need create new password "Your application-specific passwords"

    If that still dosen't work (My answer)

    Make sure the server (or IDE) is being run as admin, by either:

    1) Right clicking the program (e.g. server, ide, command prompt) and clicking "Run as Administer"

    2) OR Right click program> properties> compatiblity> Tick execute as admin

    For instance if your using the PHP in built server, run the command prompt as admin and start the server as normal using

    C:\wamp\bin\php\php5.5.12\php.exe -S localhost:80 -t C:\Users\path\to\rootFolder
    

    Of course change the file paths to suit your needs.

    EDIT: This is probally the bug you headed into https://bugs.php.net/bug.php?id=44994

    这篇关于sendmail.exe在发送邮件时打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆