Fix extraction of recipient email address when piping a message to calibre-smtp

This commit is contained in:
Kovid Goyal 2018-06-19 15:10:10 +05:30
parent f03320ac76
commit 38e2a5bdc1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -264,10 +264,7 @@ def main(args=sys.argv):
eml = message_from_string(msg)
tos = eml.get_all('to', [])
ccs = eml.get_all('cc', []) + eml.get_all('bcc', [])
all_tos = []
for x in tos + ccs:
all_tos.extend(y.strip() for y in x.split(','))
eto = list(map(extract_email_address, all_tos))
eto = [x[1] for x in getaddresses(tos + ccs) if x[1]]
if not eto:
raise ValueError('Email from STDIN does not specify any recipients')
efrom = getaddresses(eml.get_all('from', []))