php显示服务器拒绝连接失败,php – SMTP ERROR:无法连接到服务器:连接被Office365拒绝(111)...
對(duì)不起,如果這是一條走路的路.我已經(jīng)看到了關(guān)于這個(gè)的其他帖子,但他們中的任何一個(gè)都沒有解決我遇到的問題或點(diǎn)燃了一個(gè)幫我自己解決的燈泡.
這是我的代碼:
require 'PHPMailerAutoload.php';
$config = parse_ini_file('/path/to/file/config.ini', true);
$mail = new PHPMailer;
$mail->SMTPDebug = 3;
$mail->Debugoutput = 'html';
$mail->isSMTP();
$mail->Host = $config['host']; //smtp.office365.com
$mail->SMTPAuth = true;
$mail->Username = $config['username']; //an.existing.account@appinc.co
$mail->Password = $config['password']; //confirmed this is being passed correctly
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->From = $config['username'];
$mail->FromName = 'Website Forms';
$mail->addAddress('sales@appinc.co', 'Some Name');
$mail->addReplyTo('sender.email@somedomain.com', 'SenderFirst SenderLast');
$mail->addBCC('my.email.address@appinc.co');
$mail->isHTML(true);
$mail->Subject = 'Contact Form Submission';
$mail->Body = 'Some html here';
$mail->AltBody = 'Some alt content here';
if(!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
//perform success actions
exit();
}
我已經(jīng)確認(rèn)域名,用戶名和密碼都是正確的并正確傳遞.需要注意的是,這在啟動(dòng)之前在我們的本地開發(fā)服務(wù)器上有效.一旦網(wǎng)站被移動(dòng)到我們的托管帳戶(Hostgator),它就會(huì)停止工作.我已經(jīng)向HG確認(rèn)我們的服務(wù)器上已打開587端口.
這是我看到的錯(cuò)誤消息:
Connection: opening to smtp.office365.com:587, t=10, opt=array ()
SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed.
Message could not be sent.Mailer Error: SMTP connect() failed.
我們非常感謝任何可以提供的幫助,即使它只是一篇文章的鏈接,它解釋了為什么它現(xiàn)在無法在我們的生產(chǎn)環(huán)境中運(yùn)行.
總結(jié)
以上是生活随笔為你收集整理的php显示服务器拒绝连接失败,php – SMTP ERROR:无法连接到服务器:连接被Office365拒绝(111)...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 内金的功效与作用、禁忌和食用方法
- 下一篇: php数据库图片读取不出来,图片显示不出