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

Check validity of parsed email-adresses #515

Open
pajowu opened this issue Apr 26, 2022 · 0 comments
Open

Check validity of parsed email-adresses #515

pajowu opened this issue Apr 26, 2022 · 0 comments

Comments

@pajowu
Copy link
Member

pajowu commented Apr 26, 2022

Sometimes public bodies send email headers which do not conform strictly to rfc2822, which can lead to invalid email-addresses being returned by our email parser. We could filter the parsed adresses with some basic validity checks (e.g. Contains an @).

One example (adopted from a real email):

>>> from froide.helper import email_parsing
>>> import io
>>>
>>> data = b"To: 'John Doe [#123]' <john.doe@example.com>"
>>> parsed_email = email_parsing.parse_email(io.BytesIO(data))
>>> parsed_email.to
[('', "'John"), ('', ''), ('', '#123'), ('', ''), ("'", 'john.doe@example.com')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant