App Engine Mail API issue

41 views
Skip to first unread message

Vivek

unread,
Dec 13, 2012, 4:27:50 AM12/13/12
to google-a...@googlegroups.com
Hi,

I am developing application which will send mail if there is any error in script. While testing code, I observed 'is_email_valid' API is not working properly.  For every non null string it return true even if doesn't contain @ and .(dot) in it. Is it a bug or I am missing something?

Thanks,
Vivek

Vivek

unread,
Dec 13, 2012, 4:32:10 AM12/13/12
to google-a...@googlegroups.com
Just FYI....Its Python API

Vinny P

unread,
Dec 13, 2012, 10:45:46 AM12/13/12
to google-a...@googlegroups.com
No, that is technically correct behavior.

Email validation is NOTORIOUSLY difficult; the RFCs governing email addresses are very lenient in what is permitted. "b...@example.com" is the email address format that most people are familiar with, but many other formats are allowed. Did you know, for example, that nested comments are allowed in email addresses? That special characters such as "$!" are allowed in email? That email addresses can be hundreds of characters long?

You can look at http://ex-parrot.com/~pdw/Mail-RFC822-Address.html to see what an email validation regex looks like; but prepare yourself to be shocked at how long it is (and technically that regex is not RFC compliant since it does not allow nested comments). Also, see this StackOverflow post: http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address

Really, the only way to check if an email address is valid is to try to send mail to it.

-Vinny
Reply all
Reply to author
Forward
0 new messages