From 38e2a5bdc1031b3aa7060127804f986f92f5048e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Jun 2018 15:10:10 +0530 Subject: [PATCH] Fix extraction of recipient email address when piping a message to calibre-smtp --- src/calibre/utils/smtp.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/calibre/utils/smtp.py b/src/calibre/utils/smtp.py index 3875fd1b83..f8962d36b2 100644 --- a/src/calibre/utils/smtp.py +++ b/src/calibre/utils/smtp.py @@ -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', []))