【问题标题】:PHPMailer SERVER -> CLIENT: 550 5.7.1 Unable to relayPHPMailer SERVER -> CLIENT: 550 5.7.1 无法中继
【发布时间】:2014-07-25 05:53:48
【问题描述】:

我在使用 phpmailer 和 microsoft exchange 发送邮件时遇到问题。

这是我的代码:

$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'mail.myhost.com';
$mail->SMTPDebug  = 2;
$mail->Username   = "myUsername";
$mail->Password   = "myPassword";
$mail->From = "from@server.com";
$mail->AddAddress("some.address@gmail.com");
$mail->Subject = "Test";
$mail->Body = 'Test';
$mail->send();

我收到了这条消息:

2014-06-04 13:34:49 SERVER -> CLIENT: 220 SRV-******.***.local Microsoft ESMTP MAIL Service ready at Wed, 4 Jun 2014 15:38:20 +0200 
2014-06-04 13:34:49 CLIENT -> SERVER: EHLO myhost.com
2014-06-04 13:34:49 SERVER -> CLIENT: 250-SRV-******.***.local  Hello [87.254.99.10] 250-SIZE 99999744 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-X-ANONYMOUSTLS 250-AUTH 250-X-EXPS NTLM 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250-XEXCH50 250 XSHADOW 
2014-06-04 13:34:49 CLIENT -> SERVER: MAIL FROM: 
2014-06-04 13:34:49 SERVER -> CLIENT: 250 2.1.0 Sender OK 
2014-06-04 13:34:49 CLIENT -> SERVER: RCPT TO: 
2014-06-04 13:34:54 SERVER -> CLIENT: 550 5.7.1 Unable to relay 
2014-06-04 13:34:54 SMTP ERROR: RCPT TO command failed: 550 5.7.1 Unable to relay 
2014-06-04 13:34:54 CLIENT -> SERVER: QUIT 
2014-06-04 13:34:54 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel SMTP Error: The following recipients failed: some.address@gmail.com 

我的“发件人”和“收件人”邮件地址不见了...

有人知道是什么问题吗?

【问题讨论】:

标签: php exchange-server phpmailer


【解决方案1】:

首先我建议你在

中设置true
$mail = new PHPMailer(true);

对于 from 字段,将其插入括号之间并更改 setFrom

中的参数
$mail->setFrom = ("from@server.com");

【讨论】:

    猜你喜欢
    • 2018-08-02
    • 2018-04-19
    • 1970-01-01
    • 2015-03-06
    • 1970-01-01
    • 2017-10-14
    • 2013-02-05
    • 2015-03-11
    • 1970-01-01
    相关资源
    最近更新 更多