__getaddr(): Watch out for empty addresses that can happen when
something like "MAIL FROM:<CR>" is received. This avoids the
IndexError and rightly returns an SMTP syntax error.
keylen = len(keyword)
if arg[:keylen].upper() == keyword:
address = arg[keylen:].strip()
- if address[0] == '<' and address[-1] == '>' and address != '<>':
+ if not address:
+ pass
+ elif address[0] == '<' and address[-1] == '>' and address != '<>':
# Addresses can be in the form <person@dom.com> but watch out
# for null address, e.g. <>
address = address[1:-1]