Issue with isValidEmail function

5 posts by 3 authors in: Forums > CMS Builder
Last Post: October 22, 2014   (RSS)

By pault - October 14, 2014

I'm testing out the Newsletter Builder plugin to send out emails and have come across a problem sending email to an address with an apostrophe before the @ symbol.

This is a valid address but the function isValidEmail, in the file validation_functions.php returns an error.

Please can somebody look into this?

Thanks.

By Dave - October 20, 2014

Hi pault, 

I've updated the code for the next release to accept ' before @ as valid email address.  

You can make this change yourself as follows:

  1. Open /lib/validation_functions.php
  2. Search for

    [\w\-]+@

  3. Replace with 

    [\w\-\']+@\

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com

By Dave - October 20, 2014

Also, I'll just add that the email standard is very complicated and allows all kinds of odd things (including comments inside email addresses).  The real world implementations are somewhat stricter, so a '@ might not work in the real world everywhere, but there's no reason why we can't support it.  Just be mindful of that if you get a bounce from a server.

I saw some references to gmail, hotmail, and facebook being picky about single quotes, but they were from a few years ago, so hopefully they're all more permissible now.

Let me know any questions!  Cheers.

Dave Edis - Senior Developer
interactivetools.com

By pault - October 22, 2014

Thanks Dave, this work well for me.

Regards, Paul.