Zen Cart Logo
Forums / General Questions / Email addresses with ampersands in them

Email addresses with ampersands in them

Locked

Views: 6,510

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
3 Aug 2007, 11:43 AM
#1
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Email addresses with ampersands in them

Hi

We have had a few customers try to sign up with email addresses that contain Ampersands, and the email addresses are being rejected

Is there a way around this, it's not a massive issue, I have just advised them to get a gmail account to use as an alternative

I know ampersands are reserved characters etc

3 Aug 2007, 11:54 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Email addresses with ampersands in them

You can try using the backslash before the ampersand. The backslash causes the following character to lose the special meaning it usually would have in the context.

Not sure if this will work in a email addres though, but worth a try

3 Aug 2007, 12:22 PM
#3
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

Re: Email addresses with ampersands in them

I suspect it is being rejected by the zen_validate_email function, which is at the bootm of the file in /includes/functions/functions_email.php. the pattern as set accepts a-z and 0-9 only.
i.e.
$valid_email_pattern = '^[a-z0-9]+[a-z0-9_.'-]@[a-z0-9]+[a-z0-9.-].(([a-z]{2,6})|([0-9]{1,3}))$';

A bit of playing with the pattern might fix it....

Just remember:

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.

3 Aug 2007, 11:43 PM
#4
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Email addresses with ampersands in them

Chuckl:

Just remember:

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.

Yes i have experienced regular expressions,brilliantly useful, but I struggle to get my head around them

I'll look at tweaking the pattern string

19 Mar 2009, 2:49 PM
#5
balwks avatar

balwks

New Zenner

Join Date:
Oct 2005
Posts:
3
Plugin Contributions:
0

Re: Email addresses with ampersands in them

More people these days are using email addresses with a plus sign (+). The code change to make Zen Cart validate these email addresses is on line 479 (or toward the bottom) of /includes/functions/functions_email.php

$valid_email_pattern = '^[a-z0-9]+[a-z0-9_.'-+]@[a-z0-9]+[a-z0-9.-].(([a-z]{2,6})|([0-9]{1,3}))$';

(It's the + at the end of the second bracketed group.)

I humbly suggest that this be permanently integrated into Zen Cart. Sites that don't validate my Gmail "plus addressed" addresses are becoming fewer. This is the type of problem that usually doesn't annoy people enough for them to complain about it, but it's still an issue.