Strange behavior in PHP mail function, address does not exist

我们两清 提交于 2019-12-11 18:03:44

问题


I recently had this issue with a client. The code read:

ini_set( "sendmail_from", "noreply@<current-domain>.com" );

// $target_email has been validated as a value username.
// $subject is a simple String.
// $message is an HTML message.
mail( $target_email, $subject, $message );

When I tested this on my machine, it worked fine. When I tested it at home, at work, on Windows 2000 (IE6), XP (four different machines, and a VirtualBox instance) (IE6 & 7, Opera 9, Firefox 3), and Vista (IE 7), as well as through Konquerer and Firefox on Ubuntu (on two different machines), it worked fine (I don't have a Mac). I had tried the website on four different networks and in three different counties. I did everything I could to break this site, and I received no error, and the email came from noreply@<current-domain>.com to the expected address promptly.

When my client tested it at his office he got an SMTP error, saying that the name noreply@<current-domain>.com does not exist and he did not receive the email. But the same lines work fine when running on my server (basic LAMP set up running PHP 5.3, they have Windows 5.2.6).

What, exactly, happened? My best guess was that this is some bizarre windows server issue, I don't have the foggiest what else it could be. Unfortunately, I was not able to see how they configured their local machines to test this theory.


回答1:


My guess: the clients SMTP server is configured to only relay mail for known (for example: from Active Directory) adresses and reject (rightfully, one might argue) all other 'senders'? Does the noreply address exist in the clients domain?

Try sending a mail from a 'known' good user@clientdomain.com address, telnet to the smtp server, ... to try to narrow down the problem.



来源:https://stackoverflow.com/questions/1429317/strange-behavior-in-php-mail-function-address-does-not-exist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!