作者sandy4444 (質樸)
看板PHP
標題[請益] php mail 問題 需要高手幫忙QQ
時間Wed May 14 10:37:16 2014
想請教各位大大我的mail 問題
In XAMPP windows server 2008
不管是調php設定配mail()
或是用phpmailer 都不行
開始覺得是不是系統網路設定問題
telnet smtp.aa.bb 25 去 也會有回應
是防火牆要特別開哪個port 嗎 我有試過進出全開 也沒變 orz
幫我解決 願意做個遊戲網站回報
以下是我的code
<?php
require("./phpmailer/class.phpmailer.php");
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Host = 'smtp.haha.tw';
$mailer->Port = 25;
$mailer->SMTPAuth = TRUE;
$mailer->Username = '
[email protected]';
$mailer->Password = 'yoyo';
$mailer->From = 'GGGGGG';
$mailer->FromName = 'fake';
$mailer->Body = 'hahaha';
$mailer->Subject = 'hehehe';
$mailer->AddAddress('
[email protected]');
if(!$mailer->Send()){
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else{ echo "Message has been sent";}
?>
錯誤是:
SMTP Error: Could not connect to SMTP host. Message was not sent
Mailer Error: SMTP Error: Could not connect to SMTP host.
先謝謝大大回答
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.69.191.1
※ 文章網址: http://webptt.com/m.aspx?n=bbs/PHP/M.1400035039.A.E24.html
※ 編輯: sandy4444 (210.69.191.1), 05/14/2014 10:45:27
1F:→ MOONRAKER:ee.php的第12行是什麼 05/14 11:11
2F:→ sandy4444:$mail->Port = 25; 05/14 11:15
3F:→ da9nini9: ^er 錯字嗎? 05/14 11:23
4F:推 dasu88:$mail->Port = '25'; //改這樣呢? 05/14 13:56
5F:推 dasu88:打錯了:$mailer->Port='25'; 05/14 13:59
※ 編輯: sandy4444 (210.69.191.1), 05/14/2014 14:05:18
6F:→ sandy4444:對打錯了XD 但只去掉warning 而已QQ 05/14 14:06
7F:→ gname:你是用哪一家的mail? 有沒有要 ssl 05/14 14:32
8F:→ sandy4444:謝謝各位大大幫忙!!! 剛把address換成實體ip 就可以了 05/14 14:47
9F:→ sandy4444:但換來的新錯誤是SMTP Error: Could not authenticate 05/14 14:47
10F:→ sandy4444:Mailer Error: SMTP Error: Could not authenticate. 05/14 14:47
11F:推 hangchu:$mailer->Username 的值應該只有@前面的部份,就是帳號而已 05/14 23:03