![]() |
valid_email RFC specification FAIL!!! [SOLVED] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: valid_email RFC specification FAIL!!! [SOLVED] (/showthread.php?tid=25846) |
valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-28-2009 [eluser]Chalda Pnuzig[/eluser] These are the results of the function valid_email: - [email protected] : TRUE, correct. - email@èxàmplé.com : FALSE, but it's valid! - {|email|}@example.com : FALSE, but it's valid! See RFC_specification valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-28-2009 [eluser]sophistry[/eluser] that should be listed under "known issues"... that function will never be fixed - just treat it like a 90% ok function. i did some work to get it to be better. basically, the only way to know if an email is good or not is to *send* an email to the address and if it doesn't bounce, it's probably a real email address - still not definitely a real email address until you get a return email from that email address. FWIW: http://ellislab.com/forums/viewthread/89516/ cheers. valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-28-2009 [eluser]Chalda Pnuzig[/eluser] In this case 99% is not enough. :blank: valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-29-2009 [eluser]Chalda Pnuzig[/eluser] This is the correct function: Code: /** valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-29-2009 [eluser]sophistry[/eluser] hi chalda, thank you for participating! this is a really interesting function you've proffered. i think i can state unequivocally that anyone using IP addresses in emails is a spammer. also, you mentioned the RFC but the code does not implement it. also, as a start, please realize that there are several characters missing from the $specialChars array - specifically the "plus" character. perhaps you did not read the link i sent in my previous post that was discussing the plus character. i have included it here again for your convenience: http://ellislab.com/forums/viewthread/89516/ please examine this code side by side with the code you submitted. with a few revisions and some testing, i feel certain you can contribute something complete! cheers. valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-29-2009 [eluser]Chalda Pnuzig[/eluser] Do you try my function? ![]() Code: valid_email('!#$%&’*+-/=?^_`.{|}[email protected]') // return TRUE valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-29-2009 [eluser]sophistry[/eluser] no, i didn't. ![]() valid_email RFC specification FAIL!!! [SOLVED] - El Forum - 12-29-2009 [eluser]sophistry[/eluser] hi chalda, i admit the first glance i misunderstood the function of the specialChars variable - minus point for me trying to visualize a complicated regex. :-( so, upon your insistence, i tried your function and found one type of problem: it allows dashes at the start and/or end of domain names and it allows a domain like this: [email protected] in the thread i referenced, there is an array of crazy emails that i designed to test email string validators; that is how i found the dash problem. otherwise it looks like it handles some obscure points of the RFC pretty well. anyway, in that same thread there is also a pointer to a well-tested RFC-complete email checker that also does DNS testing and probes the SMTP mailserver for valid/receiving emails. in my book, that's the only real way to validate email addresses! cheers. |