【发布时间】:2015-06-19 22:58:20
【问题描述】:
Xampp 上的 Sendmail 有一些问题(Windows 安装) - 当我尝试测试电子邮件时(见下面的脚本)
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "xxx@xxx.com";
$to = "xxx@xxx.com";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
?>
运行此脚本并检查 error.log 时,我收到以下错误:
'D:\Xampp2\sendmail\sendmail.exe" -t' is not recognized as an internal or external command,
operable program or batch file.
我的设置如下所示:
PHP.ini
XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = smtp.gmail.com
smtp_port = 465
sendmail_from = katosart@gmail.com
sendmail_path="D:\xampp2\sendmail\sendmail.exe\" -t"
Sendmail.ini
smtp_server= smtp.gmail.com
smtp_port= 465
smtp_ssl= auto
auth_username=katosart@gmail.com
auth_password=(HIDDEN)
我已经尝试使用 smtp_port 区域的端口:587、465、25。 相当难倒这个 - 请问有什么想法吗? :)
【问题讨论】:
-
逃逸的
\"双引号应该做什么? -
我能问一下你的意思是抱歉吗? :)
-
我找到了你的意思,抱歉应该是:"\"D:\xampp2\sendmail\sendmail.exe\" -t" - 我来自:stackoverflow.com/questions/15965376/…
-
GMail 需要一个单独的 SMTP 每个应用程序密码。尽管您应该摆脱该 mail()+sendmail.exe 解决方法。只需使用 PHPMailer/SwiftMailer。
-
老实说以前都没有使用过,我会研究两者的教程。谢谢马里奥
标签: php batch-file xampp sendmail