使用 HTML Mime Mail for PHP 发送电子邮件,但需要通过 Exchange 服务器进行身份验证
首先,服务器:在 Windows 2003 Server sp2 上运行的 Exchange 2003 sp2
我有一个脚本,可以将电子邮件发送到两个电子邮件帐户,一个名为 Students@,另一个名为 fs@(教职员工)。 我们将这两个电子邮件帐户设置为仅接受交换服务器上经过身份验证的用户传入的电子邮件,以避免垃圾邮件。 所以现在脚本发送的电子邮件不成功。 我作为合法用户拥有返回路径电子邮件,但它未经身份验证。 我注意到,当我尝试通过我的邮件客户端(Apple 的 Mail.app)发送测试时,由于我通过他们的 IMAP 服务器而不是通过 Exchange 使用电子邮件,所以我的电子邮件也失败了。
以下是发送电子邮件的代码:
$mail = new htmlMimeMail();
$message = $today.$announcements.$food.$upcoming;
$mail->setHTML($message);
$mail->setSubject($subject);
$mail->setSMTPParams('mail.domain.com', 25, true, 'user', 'pass');
$mail->setFrom("[email protected]");
$mail->setReturnPath("[email protected]");
if($message)
$mailresult = $mail->send(array($emailto));
我从未使用 PHP 的 HTML Mime Mail (http://www.phpguru.org/static/mime.mail.html) 类之前。 任何帮助,将不胜感激。
也许还有另一个 PHP 类可以轻松地允许使用 Exchange 服务器进行身份验证?
编辑:是否有任何 php 邮件类可以通过交换服务器正确进行身份验证?
另一个编辑:Exchange Server 使用 NTLM 身份验证并使用 Active Directory。 希望这可以帮助。
First off, the server: Exchange 2003 sp2 running on Windows 2003 Server sp2
I have a script that sends email to two email accounts, one called students@ and the other being fs@ (faculty/staff). We are setting both those email accounts to only accept incoming email by authenticated users on the exchange server, to spare ourselves from spam/junk mail. So right now the emails being sent by the script are not successful. I have the return-path email as a legit user, but it is not authenticated. I noticed that when I tried sending a test via my mail client (Apple's Mail.app) and since I use email through their IMAP server and not through exchange, my email failed as well.
Here is the code for sending the email:
$mail = new htmlMimeMail();
$message = $today.$announcements.$food.$upcoming;
$mail->setHTML($message);
$mail->setSubject($subject);
$mail->setSMTPParams('mail.domain.com', 25, true, 'user', 'pass');
$mail->setFrom("[email protected]");
$mail->setReturnPath("[email protected]");
if($message)
$mailresult = $mail->send(array($emailto));
I have never authenticated with an exchange server using the HTML Mime Mail for PHP (http://www.phpguru.org/static/mime.mail.html) class before. Any help would be appreciated.
Maybe there is another PHP class that easily allows authentication with an Exchange server?
EDIT: Are there any php mail classes out there that authenticate properly with an exchange server?
Another EDIT: The Exchange Server uses NTLM authentication and uses Active directory. Hope this helps.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Exchange 支持标准的 SMTP Auth 机制,所以我会使用它。 以下是使用 Pear::Mail 的示例。 about.com/od/emailprogrammingtips/qt/et073006.htm" rel="noreferrer">此处。
Exchange supports the standard SMTP Auth mechanism, so I would use that. Here is an example using Pear::Mail from here.