Sending books by email: Allow sending to multiple email addresses at once separated by commas. Fixes #1052332 (Multiple email recipients not receiving ebooks)

This commit is contained in:
Kovid Goyal 2012-10-02 15:14:10 +05:30
parent f56b251b9f
commit e5d0bd2a89

View File

@ -101,8 +101,10 @@ class Sendmail(object):
from_ = 'calibre <calibre@'+socket.getfqdn()+'>'
with lopen(attachment, 'rb') as f:
msg = compose_mail(from_, to, text, subject, f, aname)
efrom, eto = map(extract_email_address, (from_, to))
eto = [eto]
efrom = extract_email_address(from_)
eto = []
for x in to.split(','):
eto.append(extract_email_address(x.strip()))
sendmail(msg, efrom, eto, localhost=None,
verbose=1,
relay=opts.relay_host,