Send DSN before adding message to quarantine.

This commit is contained in:
Stuart Gathman
2005-08-17 19:35:28 +00:00
parent 241717b0e2
commit 2a4ab4e87c
3 changed files with 81 additions and 54 deletions
+5 -2
View File
@@ -112,8 +112,11 @@ def send_dsn(mailfrom,receiver,msg=None):
smtp.connect(host)
code,resp = smtp.helo(receiver)
# some wiley spammers have MX records that resolve to 127.0.0.1
if resp.split()[0] == receiver:
return (553,'Fraudulent MX for %s' % domain)
a = resp.split()
if not a:
return (553,'MX for %s has no hostname in banner: %s' % (domain,host))
if a[0] == receiver:
return (553,'Fraudulent MX for %s: %s' % (domain,host))
if not (200 <= code <= 299):
raise smtplib.SMTPHeloError(code, resp)
if msg: