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

Possible mistake in (clumsy) heuristics for email-list detection #84

Open
Cheaterman opened this issue May 3, 2017 · 3 comments
Open

Comments

@Cheaterman
Copy link

Hi buddiez, I hope you're all doing goodie ^__^

I've seen the heuristics for email list detection, and to be honest I'm a bit surprised: from what I can see, the only thing it does is checking weither the iterable is of length 2, if it's a tuple, and if both email and name are string types (or name is falsey - typically empty string or None I suppose).

However, the second check seems to have a typo in the sense that it re-checks the email against string types:
https://github.com/lavr/python-emails/blob/master/emails/utils.py#L133

Other than that typo, I feel like this logic is either a bit fragile or not sufficiently documented: if name-email pairs should be tuples, the documentation should likely mention it explicitly (I do realize all examples using name-email pairs are using tuples, but AFAICS it is not explicitly said to be preferred over lists).

Thanks for reading, and thanks in advance for clarifying this issue ^__^

@lavr
Copy link
Owner

lavr commented Jul 7, 2017

Yep, that code looks weird. I'm surprised too.

@lavr
Copy link
Owner

lavr commented Jul 7, 2017

Guess here is typo in L133 - second check was to ensure that n is a string or None.

But it's clear to me now that heuristics should be rewritten on @ symbol detection.

@weakcamel
Copy link

weakcamel commented Feb 16, 2022

Yep, definitely there's a bug there, it basically hardly works if you try to specify >1 address at the same time.

["[email protected]", "[email protected]"] gets turned into To:<[email protected]> which in my case ends up with the email being silently dropped.

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

3 participants