1

There is a particular member in my site that needs access but her corporate email that is attached to her account has an apostrophe in it. How do I allow EE to allow apostrophes in emails for member accounts?

  • If it was me I would be getting her tech department to create her an alias without the apostrophe. Would save a lot of hassle. – John Henry Donovan Mar 9 '13 at 1:56
  • That was my first thought, but this person works for a giant multi-national oil company who's less likely to change their email stuff any time soon. – lealea Mar 9 '13 at 2:17
5

In order to allow the apostrophe, I had to hack the core code. Specifically, a CodeIgniter helper within:

/system/codeigniter/system/helpers/email_helper.php

In there, find around line 40 this:

return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;

Then replace that line with this instead:

return ( ! preg_match("/^([a-z0-9\+_\-']+)(\.[a-z0-9\+_\-']+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;

Found the particular regex in an old EE Forum Thread here: http://ellislab.com/forums/viewthread/84711/

Anything wrong with this approach or the expression used?

| improve this answer | |
  • Yup, I would just do this and document it in a 'hacks.txt' in the site root for reference. :) – Nathan Pitman Nov 12 '13 at 10:43
1

Incase someone else comes to this post.. this has heen resolved in the developer version of codeigniter.

https://github.com/EllisLab/CodeIgniter/issues/3116

Be sure to also update the Form_validation class as the email validation function there is different from the email_helper functions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.