Skip to content

Commit

Permalink
Add support for multiple Reply to addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloPhagula committed Jan 2, 2018
1 parent fd69228 commit c6cc197
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Code Example
cc='[email protected], [email protected]',
bcc=['[email protected]', ('You Know Who', '[email protected]')],
sender=('AwesomeApp', '[email protected]'),
reply_to='[email protected]',
reply_to='[email protected], [email protected]',
attachments=['/full/path/to/attachment.ext'],
custom_headers={'X-Mailer': 'SendMail'}
)
Expand Down
7 changes: 2 additions & 5 deletions send_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ def send_mail(subject,
.. envvar:: SMTP_DEBUG
Flag indicating if debug mode is enabled.abs
.. todo::
Allow many addresses in `reply_to`
"""

# 1. Parse and Validate Email Addresses
Expand All @@ -171,7 +168,7 @@ def send_mail(subject,
sender = _parse_mail_address(sender)

if reply_to:
reply_to = _parse_mail_address(reply_to)
reply_to = _parse_multiple_mail_addresses(reply_to)

all_destinations = []

Expand Down Expand Up @@ -207,7 +204,7 @@ def send_mail(subject,
mail['Cc'] = COMMASPACE.join(list(map(formataddr, cc)))

if reply_to:
mail['Reply-To'] = formataddr(reply_to)
mail['Reply-To'] = COMMASPACE.join(list(map(formataddr, reply_to)))

mail['Date'] = formatdate(localtime=True)
mail['Message-ID'] = make_msgid()
Expand Down
4 changes: 2 additions & 2 deletions test_send_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_full_email_is_sent(self):
('You Know Who', '[email protected]')
],
sender=('App', '[email protected]'),
reply_to='[email protected]',
reply_to='[email protected], [email protected]',
attachments=[
os.path.abspath(os.path.dirname(__file__)) + '/LICENSE',
os.path.abspath(os.path.dirname(__file__)) + '/README.rst'
Expand All @@ -89,7 +89,7 @@ def test_full_email_is_sent_with_details_as_keywords(self):
('You Know Who', '[email protected]')
],
sender=('App', '[email protected]'),
reply_to='[email protected]',
reply_to='[email protected], [email protected]',
attachments=[
os.path.abspath(os.path.dirname(__file__)) + '/LICENSE',
os.path.abspath(os.path.dirname(__file__)) + '/README.rst'
Expand Down

0 comments on commit c6cc197

Please sign in to comment.