使用 Zend_Mail 通过 Exchange Server 发送 SMTP 电子邮件 - 如何诊断这些错误

发布于 2024-09-27 07:58:14 字数 2286 浏览 4 评论 0原文

我有以下代码:

$config = array(
   'auth' => 'login',
   'username' => 'domain\user',
   'password' => 'password',
   'ssl' => 'tls',
   'port' => 25,
);

$tr = new Zend_Mail_Transport_Smtp('192.168.101.11',$config);
Zend_Mail::setDefaultTransport($tr);

$mail = new Zend_Mail();
$mail->setBodyText($text);
$mail->setFrom('[email protected]');
$mail->addTo($user->getEmail());
$mail->setSubject('Email subject');
$mail->send();

当我尝试使用正确的凭据进行连接时,我在日志中收到以下错误:

2010-10-12T13:00:59-07:00 ERR (3): AdminController::emailPassword - 5.7.1
2010-10-12T13:00:59-07:00 ERR (3): AdminController::emailPassword - #0 /usr/share/php/Zend/Mail/Protocol/Smtp.php(261): Zend_Mail_Protocol_Abstract->_expect(250, 300)
        #1 /usr/share/php/Zend/Mail/Transport/Smtp.php(207): Zend_Mail_Protocol_Smtp->mail('noreply@domain...')
        #2 /usr/share/php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
        #3 /usr/share/php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
...

当我尝试使用绝对错误的密码连接并发送电子邮件时,我收到以下错误:

2010-10-12T13:03:52-07:00 ERR (3): AdminController::emailPassword - 5.7.3
2010-10-12T13:03:52-07:00 ERR (3): AdminController::emailPassword - #0 /usr/share/php/Zend/Mail/Protocol/Smtp/Auth/Login.php(95): Zend_Mail_Protocol_Abstract->_expect(235)
#1 /usr/share/php/Zend/Mail/Protocol/Smtp.php(217): Zend_Mail_Protocol_Smtp_Auth_Login->auth()
#2 /usr/share/php/Zend/Mail/Transport/Smtp.php(200): Zend_Mail_Protocol_Smtp->helo('localhost')
#3 /usr/share/php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#4 /usr/share/php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#5 /var/www/mreserve/application/controllers/AdminController.php(458): Zend_Mail->send()
...

我的问题,我真的不知道如何诊断这些错误。在哪里可以查找 5.7.1 和 5.7.3 错误代码的描述等?谷歌并没有给我太多帮助。当我插入个人 GMail 帐户的凭据时,我可以正常发送邮件,因此我知道配置正确后可以发送电子邮件。

其他一些可能有用的花絮,我正在尝试从已为此用户创建电子邮件帐户的公司 Exchange 发送,我正在尝试发送到域外部的电子邮件,并且我没有太多访问权限交换服务器 - 除了一些关于他们如何设置电子邮件客户端的屏幕截图。

I have the following code:

$config = array(
   'auth' => 'login',
   'username' => 'domain\user',
   'password' => 'password',
   'ssl' => 'tls',
   'port' => 25,
);

$tr = new Zend_Mail_Transport_Smtp('192.168.101.11',$config);
Zend_Mail::setDefaultTransport($tr);

$mail = new Zend_Mail();
$mail->setBodyText($text);
$mail->setFrom('[email protected]');
$mail->addTo($user->getEmail());
$mail->setSubject('Email subject');
$mail->send();

When I try to connect using what should be the correct credentials I get the following error in the log:

2010-10-12T13:00:59-07:00 ERR (3): AdminController::emailPassword - 5.7.1
2010-10-12T13:00:59-07:00 ERR (3): AdminController::emailPassword - #0 /usr/share/php/Zend/Mail/Protocol/Smtp.php(261): Zend_Mail_Protocol_Abstract->_expect(250, 300)
        #1 /usr/share/php/Zend/Mail/Transport/Smtp.php(207): Zend_Mail_Protocol_Smtp->mail('noreply@domain...')
        #2 /usr/share/php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
        #3 /usr/share/php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
...

When I try to connect and send an email using a definitely bad password I get the following error:

2010-10-12T13:03:52-07:00 ERR (3): AdminController::emailPassword - 5.7.3
2010-10-12T13:03:52-07:00 ERR (3): AdminController::emailPassword - #0 /usr/share/php/Zend/Mail/Protocol/Smtp/Auth/Login.php(95): Zend_Mail_Protocol_Abstract->_expect(235)
#1 /usr/share/php/Zend/Mail/Protocol/Smtp.php(217): Zend_Mail_Protocol_Smtp_Auth_Login->auth()
#2 /usr/share/php/Zend/Mail/Transport/Smtp.php(200): Zend_Mail_Protocol_Smtp->helo('localhost')
#3 /usr/share/php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#4 /usr/share/php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#5 /var/www/mreserve/application/controllers/AdminController.php(458): Zend_Mail->send()
...

My problem, I don't really know how to diagnose these errors. Where do I look up what 5.7.1 and 5.7.3 error codes are described, etc? Google wasn't helping me too much. When I plug in the credentials for my personal GMail account I am able to send mail just fine, so I know that I can send emails when configured correctly.

A few other possibly helpful tidbits, I am trying to send from a company Exchange that has created an email account for this user, I am trying to send to an email outside of the domain, and I don't have a lot of access to the exchange server- other than a few screenshots on how they set up their email clients.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

濫情▎り 2024-10-04 07:58:14

这些是 Exchange 服务器的 NDR(未送达报告)代码。
这是一个(相当旧的)博客条目描述它们,以及另一个列出相同代码的页面< /a> for Exchange 2007。

5.7.1 错误代码

“权限问题”,可能指向 a:

  • a SMTP中继问题。您的帐户无权向其他域发送电子邮件。
  • 发送者/接收者问题。您的帐户无权向讨论列表发送电子邮件(因为您的帐户不是其中的成员)
  • 您帐户的其他特定限制。

恕我直言,只有 SMTP 日志才能告诉您确切的原因。

5.7.3 错误代码

“禁止发件人”或“未经授权,安全问题”,具体取决于来源;可能与错误的密码提交一致。

希望这有帮助。

These are NDR (Non Delivery Report) codes for Exchange server.
Here is a (rather old) blog entry describing them, and another page listing the sames codes for exchange 2007.

5.7.1 Error code

"permission problem", which could point to a:

  • a SMTP relay problem. Your account is not authorized to send emails to another domain.
  • a sender/receiver problem. Your account is not authorized to send emails to a discussion list (because your account is not a member of it)
  • other specific restrictions on your account.

IMHO, only the SMTP logs can tell the exact cause.

5.7.3 Error code

"sender prohibited" or "Not Authorized, security problem", depending on the source; could be consistent with wrong password submission.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文