[英]Office365 via GoDaddy SMTP does not work
我正在使用 PHPMailer 並嘗試過其他人,但這根本行不通。 我不斷收到服務器一直拒絕我訪問的錯誤消息。 這是使用的示例代碼:
<?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
似乎有什么問題? 我在網上查了很多帖子,但似乎沒有任何效果。 有任何想法嗎?
對於 GoDaddy Office365 帳戶,您必須使用 GoDaddy 安全 SMTP 服務器:smtpout.secureserver.net
請參考https://za.godaddy.com/help/server-and-port-settings-for-workspace-email-6949 。
如果您使用的是 GoDaddy Linux 托管試試這個:
mail_mailer=smtp
mail_host=localhost //使用本地主機因為我們在同一個域中
mail_port=25
mail_username= //留空
mail_password= //留空
mail_encryption= // 留空
mail_from_address=username@udomin.com//這與您的 email 用戶名相同
mail_from_name=stackoverflow // 任意名稱
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.