【问题标题】:sendmail.exe" -t' is not recognized as an internal or external commandsendmail.exe" -t' 未被识别为内部或外部命令
【发布时间】: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


【解决方案1】:

好的!所以我自己通过评论解决了这个问题:

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

【讨论】:

  • 我已经允许访问不太安全的应用程序,重新测试脚本,现在得到:警告:邮件():SMTP 服务器响应:530 5.7.0 必须先发出 STARTTLS 命令。 q2sm18977843wjz.15 - 第 9 行 D:\xampp2\htdocs\test-email.php 中的 gsmtp
猜你喜欢
  • 2014-04-29
  • 1970-01-01
  • 1970-01-01
  • 2013-10-06
  • 2013-10-11
  • 2013-01-25
  • 2016-10-01
  • 2022-01-22
  • 2012-02-06
相关资源
最近更新 更多