Apostrophes in email addresses not supported by QEmailServer.class.php

thread: 3 messages  |  last: a year ago  |  started: wednesday, march 3, 2010, 4:11 am pst


#1  |  Skaffen (Berkshire, UK) United Kingdom
Wednesday, March 3, 2010, 4:11 AM PST

Apostrophes are valid in the local part of email addresses - I think the problem is with this line:

preg_match_all (“/[a-zA-Z0-9_.+-]+[@][\-a-zA-Z0-9_.]+/”, $strAddresses, $strAddressArray);

If you add in a ' to the matching of the local part then it works fine, without that it strips off the bit in front of the '.

NB: there are actually a few other characters permitted in local parts not covered by this, if you wanted to be able to match any syntactically RFC 2822 valid local part I think you'd use [a-zA-Z0-9!#$%&'*+/=?^_.`{|}~-]+  - this would allow some invalid addresses through as a . is only allowed between two characters which aren't dots and can't appear at the start or end of the local part, but accounting for that quirk is probably overkill. Most of those characters aren't used out in the real world tho' for human email addresses with the exception of apostrophe which comes in with Irish patronymic surnames like e.g.: Jon.O'Reilly@somedomain.com

#2  |  marcosdsanchez (Buenos Aires, Argentina) Argentina
Wednesday, March 3, 2010, 5:54 AM PST

This has been discussed a lot here: http://trac.qcu.be/projects/qcubed/ticket/27

To sum up, this RegExp should work for what you need:
“/[a-zA-Z0-9_.'%+-]+[@][\-a-zA-Z0-9_.]+/”
also take a look at the arpad3 approach.

Cheers,

Marcos

#3  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Sunday, March 7, 2010, 1:28 PM PST

Thanks... could you open up a ticket in the issue tracker for this, or can someone submit a patch to me via github?



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.