flanker icon indicating copy to clipboard operation
flanker copied to clipboard

Any one email contains non-ASCII characters return all emails are invalid even valid email present

Open Premanandh-S opened this issue 7 years ago • 4 comments

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 ?

Premanandh-S avatar Nov 21 '17 14:11 Premanandh-S

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]'])

horkhe avatar Nov 22 '17 18:11 horkhe

Not working the following code and show the following error

screen shot 2017-11-23 at 10 23 24 am

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
""

Premanandh-S avatar Nov 23 '17 04:11 Premanandh-S

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.

horkhe avatar Nov 23 '17 06:11 horkhe

Adding # coding:utf-8 only fixed the syntax error.

Eventually I fixed this issue by remove email which contains non-ASCII characters.

Premanandh-S avatar Nov 29 '17 13:11 Premanandh-S