|
|
| |
1. A-record ignored / 450 greylisting / timeout |
|
Reply |
|
|
 Christopher Kramer | 2010-12-15 15:59:37 |
I stumbled upon three problems with this class:
1. RFC 2821 says that if no MX-record is there, the A-record is used
This might be a bad way to set up your domain (because RFC 974 clients might not be able to mail you), but I know there are domains set up like this.
To make sure these mail-adresses will be accepted, I changed getMXrecords:
public function getMXrecords($hostname) {
$mxhosts = array();
$mxweights = array();
if (getmxrr($hostname, $mxhosts, $mxweights)) {
array_multisort($mxweights, $mxhosts);
}
// add A-record as last chance (e.g. if no MX record is there)
$mxhosts[]=$hostname;
return $mxhosts;
}
2. Some Servers that do greylisting respond 450 instead 451 or 452, so I added this as a valid response:
} elseif ($code == '451' || $code == '452' || $code=='450') {
3. Slow servers / timeout
I had problems with servers that respond very slowly. I needed a timeout of 30 seconds for some servers to finish properly. Moreover, if the server responds very slowly, the class might interprete one respond that comes late as one that is new. Example:
HELO
MAIL FROM: <test1@example.com>
------timeout-----
RCPT TO: <test2@example.com>
250 2.1.0 <test1@example.com>... Sender ok
RSET
554 5.7.1 test2@example.com unknown user account
QUIT
The class thinks the address is valid, because the response that came after RCPT TO was 250 but in fact this response was the response to MAIL FROM instead of RCPT TO.
So if you have a slow server that connects but responds slowly to MAIL FROM (e.g. because it checks _your_ MAIL FROM address the same way you are checking his) you might detect an in-existent address as existent.
This can be worked around using huge timeouts (probably a bad idea) or smarter response-analyzing (which I have not done yet). |
| |
2. Re: A-record ignored / 450 greylisting / timeout |
|
Reply |
|
|
 Konstantin Granin | 2010-12-16 16:03:40 - In reply to message 1 from Christopher Kramer |
| Thanks, has added. |
|