PHPMailer给我以下错误 [英] PHPMailer is giving me the following error

查看:144
本文介绍了PHPMailer给我以下错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHPMailer,当我尝试运行以下PHP时,出现了此错误消息:

I am using PHPMailer, and when I tried to run the following PHP I got this error message:

无法发送消息.Mailer错误:SMTP错误:数据不被接受.SMTP服务器错误:DATA END命令失败详细信息:5.7.60 SMTP;客户端无权发送此发件人SMTP代码:550

Message could not be sent.Mailer Error: SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: 5.7.60 SMTP; Client does not have permissions to send as this sender SMTP code: 550

php代码:

<?php

require 'phpmailer/PHPMailerAutoload.php';

$mail = new PHPMailer;

//$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'outlook.office365.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'info@domain.com';                 // SMTP username
$mail->Password = '*password*';                           // 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->addAddress('ellen@example.com');               // Name is optional
$mail->addReplyTo('info@example.com', 'Information');
// $mail->addCC('cc@example.com');
// $mail->addBCC('bcc@example.com');

$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';
}


?>

推荐答案

我不确定说客户端没有作为该发件人的发送权限"时是否会更清晰.就是说的意思.

I'm not sure it could be much clearer when it says "Client does not have permissions to send as this sender". It means exactly what it says.

您正在使用from@example.com的发件人地址(默认情况下也用作信封发件人;请参见Sender属性)发送邮件,而Outlook不愿意让您使用该地址.您可能会被限制使用同时也是您的用户名的地址. Gmail也有类似的限制.

You are sending using a from address (which by default is also used as the envelope sender; see the Sender property) of from@example.com, and outlook is not willing to let you use that address. You will probably be limited to using the address that is also your user name. Gmail has a similar limitation.

这篇关于PHPMailer给我以下错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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