2010-12-07 119 views
0

我已經下載了XAMPP的最新更新,這幾乎搞砸了我的舊配置。我一度能夠用PHP發送基本的郵件(),但是一旦我更新它就停止了。用phpmailer和XAMPP調試PHP郵件到雅虎郵箱

我研究了一下,大家都推薦Zend或PHPMailer。我試過PHPMailer,它給我返回一個錯誤,說cound沒有得到迴應。

與我的php.ini混淆,並將套接字超時從60增加到120.這沒有奏效,所以我試着發送測試郵件給自己。

Failed to connect to mailserver at "localhost" port 25, 
verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() 

所以,我檢查的php.ini

[mail function] 
; For Win32 only. 
; http://php.net/smtp 
SMTP = localhost 
; http://php.net/smtp-port 
smtp_port = 25; 

;Add X-PHP-Originating-Script: that will 
;include uid of the script followed by the filename 

好了,我想,「我只是用PHPMailer的,包括SMTP和端口:

require_once('../class.phpmailer.php'); 

$mail    = new PHPMailer();  // defaults to using php "mail()"; 

$body    = file_get_contents('contents.html'); 
$body    = eregi_replace("[\]",'',$body); 

$mail->IsSMTP();       // telling the class to use SMTP 
$mail->AddReplyTo("[email protected]","Company Name Here"); 
$mail->Host  = "localhost";   // SMTP server 
$mail->SMTPDebug = 2;      // enables SMTP debug information (for testing) 
$mail->Port  = 25;      // set the SMTP port for the GMAIL server 


$mail->From  = "[email protected]"; 
$mail->FromName = "Company Name Here"; 

$address = "[email protected]"; 
$mail->AddAddress($address, "Hello to myself for testing!"); 

$mail->Subject = "PHPMailer Test Subject via mail(), basic"; 

$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test 

$mail->MsgHTML($body); 

//$mail->AddAttachment("images/phpmailer.gif");  // attachment 
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment 

if(!$mail->Send()) { 
    echo "Mailer Error: " . $mail->ErrorInfo; 
} else { 
    echo "Message sent!"; 
} 

mail.add_x_header = Off 

哪說:

SMTP -> ERROR: Failed to connect to server: 
A connection attempt failed because the connected 
party did not properly respond after a period of 
time, or established connection failed because 
connected host has failed to respond. (10060) 

SMTP Error: Could not connect to SMTP host. 
Mailer Error: SMTP Error: Could not connect to SMTP host. 

水星說:

This message is sending now ... 

Error! The message was not successfully sent! 

Zurück zum Formular 

花了所有的時間,我想知道現在,是我的代碼,php.ini,phpmailer,或雅虎?

回答

0

我認爲你錯過了一個郵件服務器。或者你有一個本地郵件服務器運行在25端口? ;-)但XAMPP帶來了一個名爲Mercury的郵件服務器 - 所以...開始吧,玩得開心;-)。

+0

你提醒我,所以我啓動了它,但我仍然得到相同的錯誤:( – Chenelle 2010-12-07 18:54:27