通过 GoDaddy SMTP 的 Office365 不起作用 [英] Office365 via GoDaddy SMTP does not work

查看:142
本文介绍了通过 GoDaddy SMTP 的 Office365 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHPMailer 并尝试过其他人,但这根本行不通.我不断收到服务器不断拒绝我访问的错误.这是使用的示例代码:

I'm using PHPMailer and have tried others but this simply does not work. I keep getting an error that the server keeps denying me access. Here is the example code used:

<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3;                               // Enable verbose debug output
$mail->isSMTP();                                      // Set mailer to use    SMTP
$mail->Host = 'smtp.office365.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP   authentication
$mail->Username = 'xx@xx.com';                 // SMTP username
$mail->Password = 'xxx';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->setFrom('from@example.com', 'Mailer');
$mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient
$mail->addReplyTo('info@example.com', 'Information');
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}

我使用的是他们官方文档中显示的相同设置:https://support.office.com/en-gb/article/POP-and-IMAP-settings-for-Outlook-Office-365-for-business-7fc677eb-2491-4cbc-8153-8e7113525f6c

I'm using the same settings as shown in their official documentation: https://support.office.com/en-gb/article/POP-and-IMAP-settings-for-Outlook-Office-365-for-business-7fc677eb-2491-4cbc-8153-8e7113525f6c

似乎有什么问题?我已经在许多帖子中在线检查过,但似乎没有任何效果.有什么想法吗?

What seems to be an issue? I have checked online in a number of posts but nothing seems to be working. Any ideas?

推荐答案

对于 GoDaddy Office365 帐户,您必须使用 GoDaddy 安全 SMTP 服务器:smtpout.secureserver.net

For GoDaddy Office365 accounts you must use the GoDaddy secure SMTP server: smtpout.secureserver.net

请参考https://za.godaddy.com/help/server-and-port-settings-for-workspace-email-6949.

这篇关于通过 GoDaddy SMTP 的 Office365 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆