We're deploying Zenoss and found that some of the email alert messages that
were being delivered to Zenoss were not being properly handled. The problem
turns out to be an omission in the Python Twisted SMTP class in that it cannot
handle an email address that contains an address-literal (cf. Section 4.1.2 or
RFC 5321), for example, zenoss@[10.100.1.192]
This is a valid mailbox address but the 8.1.0 version of the Twisted SMTP Class
rejects such addresses with a "501 Syntax error". No idea if this has been
fixed in more recent versions (and no time to find out for myself).
I am no Python programmer so I'm sure others can do better than this, but here
is my fix for this problem:
*** smtp.py
--- smtp.py.original
***************
*** 412,423 ****
else:
# Now in domain
domain = ['']
- elif atl[0] == '[':
- if not domain:
- raise AddressError, "[ encountered on LHS"
- elif atl[-1] != ']':
- raise AddressError, "Unbalanced []"
- atl = atl[1:-1]
elif len(atl[0]) == 1 and not self.atomre.match(atl[0]) and
atl[0] != '.':
raise AddressError, "Parse error at %r of %r" % (atl[0],
(addr, atl))
else:
--- 412,417 ----
***************
*** 627,633 ****
# A string of quoted strings, backslash-escaped character or
# atom characters + '@.,:'
! qstring = r'("[^"]*"|\\.|' + atom + r'|[@.,:\[\]])+'
mail_re = re.compile(r'''\s*FROM:\s*(?P<path><> # Empty <>
|<''' + qstring + r'''> # <addr>
--- 621,627 ----
# A string of quoted strings, backslash-escaped character or
# atom characters + '@.,:'
! qstring = r'("[^"]*"|\\.|' + atom + r'|[@.,:])+'
mail_re = re.compile(r'''\s*FROM:\s*(?P<path><> # Empty <>
|<''' + qstring + r'''> # <addr>
~~~~~
George Pajari - Glentel Inc.
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python