2

我刚刚从 XAMPP 1.7.3 升级到 1.8.0,在我重新安装开发环境时,这包括很多更改(PHP 5.4 等)。无论如何,现在一切正常,除了 Sendmail。之前,您在 sendmail.ini 中有这样的配置:

#defaults
logfile "C:\XAMPP\sendmail\sendmail.log"

## A freemail service example
account Hotmail
tls on
tls_certcheck off
host smtp.live.com
from [exampleuser]@testmail.loc
auth on
user [exampleuser]@hotmail.com
password [examplepassword]

# Set a default account
account default : Hotmail

加上 php.ini 中的一些值:

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

现在一切看起来都大不相同了(旧的配置不起作用),例如: http: //pastebin.com/M83bNmJw

一个小的 php 邮件脚本:

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
 $to = "someone@hotmail.com";
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";
 if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
?>

消息传递失败...我想我太愚蠢了,无法更改正确的内容,它只是行不通,而且我的日志文件中几乎没有错误,所以我什至不知道从哪里开始。

4

4 回答 4

1
 #GMAIL mit XAMPP 1.8.1 und sendmail
[CODE]
[sendmail]
; HOTMAIL
smtp_server=smtp.gmail.com
smtp_port=25
smtp_ssl=tls
tls_certcheck off
error_logfile=error.log
debug_logfile=debug.log
auth_username= xxxx.xxxx@gmail.com
auth_password=xxxxxxx


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

    ; For Win32 only.
    ; http://php.net/sendmail-from
    sendmail_from = xxxx.xxxx@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:\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"

    ; Force the addition of the specified parameters to be passed as extra parameters
    ; to the sendmail binary. These parameters will always replace the value of
    ; the 5th parameter to mail(), even in safe mode.
    ;mail.force_extra_parameters =

    ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
    mail.add_x_header = Off

    ; Log all mail() calls including the full path of the script, line #, to address and headers
    mail.log = "C:\xampp\php\logs\php_mail.log"
于 2012-11-05T05:54:24.197 回答
0

我的 xampp 是 1.8.2,窗口是 8.1

在 php.ini 中

    smtp_port = 587
    sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
    mail.add_x_header=Off

在 sendmail.ini 中

    smtp_server=smtp.gmail.com
    smtp_port=587
    smtp_ssl=auto
    error_logfile=error.log
    auth_username=xxaayy@gmail.com
    auth_password=kskcmhlrjr

    pop3_server=
    pop3_username=
    pop3_password=

    force_sender=xxaayy@gmail.com
    force_recipient=
    hostname=

要帐户 gmail“auth_password”,您需要创建新密码“您的应用程序特定密码”,请查看 [此处][1]

然后按照以下步骤操作:

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

  1. 右键单击 sendmail.exe
  2. 特性
  3. 兼容性
  4. 更改所有用户的配置
  5. 作为 Windows XP SP 3 执行
  6. 以管理员身份执行
  7. 测试电子邮件

    $to = "aaaaaaa@domain.com";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";
    $headers = "From: xxaayy@gmail.com" . "\r\n";
    if (mail($to, $subject, $body, $headers)) {
       echo ("Message successfully sent!");
    } else {
       echo ("Message delivery failed...");
    }
    
于 2014-05-26T05:31:21.520 回答
0

我看到在1.8.0中,默认会通过mailtodisk.exe发送邮件。您已经在 PHP 配置文件中启用了它,但是您是否禁用了 mailtodisk.exe?

此外,您需要确保smtp_server在 sendmail.ini 中设置为localhost.

我自己刚刚找到了这个解决方案,所有使用 PHP 发送的邮件都有效。

于 2012-09-09T09:58:17.870 回答
-1

我找到了一个可行的例子,它现在就像一个魅力

http://blog.joergboesche.de/xampp-sendmail-php-mailversand-fuer-windows-konfigurieren#xampp_180_sendmail

于 2012-09-10T14:41:56.070 回答