flanker
flanker copied to clipboard
Any one email contains non-ASCII characters return all emails are invalid even valid email present
I am using mail gun managed account for sending email and using flanker library for validating emails. Some times many valid emails are not returned in email list validation. Please look into this ASAP.
I have used the following code for validate email list
validate_email_list.py looks like following
import sys
sys.path.append('/opt/third-party-packages')
from flanker.addresslib import address
print address.validate_list(sys.argv[1])
Run above code
python validate_email_list.py '[email protected]Æm,[email protected],[email protected]'
It's working fine when I remove [email protected]Æm
Is this encoding issue ?
Passing a comma separated string to validate_list
is suboptimal. Due to grama ambiguity the result may not be what you want it to be. When possible it is always better to pass a list of strings like this: validate_list(['[email protected]Æm', '[email protected]', '[email protected]'])
Not working the following code and show the following error
File "validate_email_list.py", line 6
SyntaxError: Non-ASCII character '\xc3' in file validate_email_list.py on line 6, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
""
You are using a non-ASCII literal in a file that does not have encoding declared. Add # coding:utf-8
as the first line of your file.
Adding # coding:utf-8
only fixed the syntax error.
Eventually I fixed this issue by remove email which contains non-ASCII characters.