2015-06-19 109 views
0

有上XAMPP(Windows安裝)使用Sendmail的一些問題 - 當我嘗試測試電子郵件(請參見下面的腳本)sendmail.exe」 -t」不被識別爲一個內部或外部命令

<?php 
ini_set('display_errors', 1); 
error_reporting(E_ALL); 
$from = "[email protected]"; 
$to = "[email protected]"; 
$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 = [email protected] 
sendmail_path="D:\xampp2\sendmail\sendmail.exe\" -t" 

Sendmail.ini

smtp_server= smtp.gmail.com 
smtp_port= 465 
smtp_ssl= auto 
[email protected] 
auth_password=(HIDDEN) 

我一直在使用的端口的嘗試:587,465,25爲SMTP_PORT區域。 相當難倒這一個 - 任何想法請嗎? :)

+0

什麼是流浪逃脫'\「'本來雙引號做 – mario

+0

我可以問你的意思是遺憾? ?:) –

+0

我發現你的意思,對不起,它應該是:「\」D:\ xampp2 \ sendmail \ sendmail.exe \「-t」 - 我從:http://stackoverflow.com/questions/ 15965376/how-to-configure-xampp-to-send-mail-from-localhost –

回答

0

OK!因此,我已被註釋掉制定了這一點,我自己:

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

不過,我現在得到了來自谷歌電子郵件說:

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 
+0

我已經允許訪問不太安全的應用程序,重新測試腳本,現在得到:警告:mail():SMTP服務器響應:530 5.7.0必須首先發出STARTTLS命令。 q2sm18977843wjz.15 - 第9行D:\ xampp2 \ htdocs \ test-email.php中的gsmtp –

相關問題