sendmail.exe“-t”未被识别为内部或外部命令

时间:2015-06-19 22:58:21

标签: php batch-file xampp sendmail

在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)

我尝试使用端口:587,465,25作为smtp_port区域。 相当难倒这个 - 请问任何想法? :)

1 个答案:

答案 0 :(得分:0)

OK!所以我自己通过评论来解决这个问题:

sendmail_path="D:\xampp2\sendmail\sendmail.exe\" -t"

但是,我现在收到了来自Google的电子邮件说:

We recently blocked a sign-in attempt to your Google Account 

所以电子邮件正在通过。 我担心这会对收到同样问题的其他收件人产生影响吗?

编辑: 在运行上述脚本时出错,错误是:

Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. q2sm18977843wjz.15 - gsmtp in D:\xampp2\htdocs\test-email.php on line 9