Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comma in Email Address Name #78

Open
nashley opened this issue Jul 17, 2017 · 0 comments
Open

Comma in Email Address Name #78

nashley opened this issue Jul 17, 2017 · 0 comments
Labels
1.bug An error has been encountered that is preventing utilization. area:message Issue relates to the MIME e-mail Message object representation.

Comments

@nashley
Copy link

nashley commented Jul 17, 2017

Commas in the name in an email address cause the address parser to parse the address as multiple addresses and therefore fail.

Take the following address for example:
"Bond, James" <james.bond@spies.com>
It should have Bond, James as the name and james.bond@spies.com as the email, but instead it tries to parse Bond as an email address and fails.

Here's a traceback:

Traceback (most recent call last):
  File "__main__.py", line 136, in <module>
    main()
  File "__main__.py", line 126, in main
    download_calendars()
  File "__main__.py", line 111, in download_calendars
    sender='bondvillian@evil.com'
  File "/usr/local/lib/python3.6/site-packages/marrow/mailer/message.py", line 79, in __init__
    self.author = author
  File "/usr/local/lib/python3.6/site-packages/marrow/mailer/message.py", line 95, in __setattr__
    object.__setattr__(self, name, value)
  File "/usr/local/lib/python3.6/site-packages/marrow/mailer/address.py", line 222, in __set__
    value = self.cls(value)
  File "/usr/local/lib/python3.6/site-packages/marrow/mailer/address.py", line 145, in __init__
    self.extend(addresses)
  File "/usr/local/lib/python3.6/site-packages/marrow/mailer/address.py", line 182, in extend
    values = [Address(val) if not isinstance(val, Address) else val for val in sequence]
  File "/usr/local/lib/python3.6/site-packages/marrow/mailer/address.py", line 182, in <listcomp>
    values = [Address(val) if not isinstance(val, Address) else val for val in sequence]
  File "/usr/local/lib/python3.6/site-packages/marrow/mailer/address.py", line 58, in __init__
    raise ValueError('"{0}" is not a valid e-mail address: {1}'.format(email, err))
ValueError: "Bond" is not a valid e-mail address: An email address must contain a single @

This behavior is only expected if the name is not encapsulated with quotes.

@amcgregor amcgregor added 1.bug An error has been encountered that is preventing utilization. area:message Issue relates to the MIME e-mail Message object representation. labels Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.bug An error has been encountered that is preventing utilization. area:message Issue relates to the MIME e-mail Message object representation.
Projects
None yet
Development

No branches or pull requests

2 participants