Php send mail code problem

Capcom Street fighter iv (ps3)
September 17, 2009 at 07:41:30
Specs: Windows XP
I have the current code, but have just found out that is doesn't allow certain email addresses to work:

elseif (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $from))

So if I have an email of:
mynamehere-@domain.com

It would fail, can anyone advise which part of the code I should change.

Thanks Ian

Venta Sanlucar


See More: Php send mail code problem

Report •


#1
September 18, 2009 at 16:33:16
Hi, are you trying to validate the email address? I prefer using eregi function.

Perhaps try using preg_match with this regular expression:

/^[^\x00-\x20()<>@,;:\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\".[\]\x7f-\xff]+)*\@[^\x00-\x20()<>@,;:\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\".[\]\x7f-\xff]+)+$/i

or

/^[a-zA-Z0-9\!\#\$\%\&'\*\+\-\/=\?\^\_\`\{\|\}\~]+(\.[a-zA-Z0-9\!\#\$\%\&'\*\+\-\/=\?\^\_\`\{\|\}\~]+)*@[a-zA-Z0-9\!\#\$\%\&'\*\+\-\/=\?\^\_\`\{\|\}\~]+(\.[a-zA-Z0-9\!\#\$\%\&'\*\+\-\/=\?\^\_\`\{\|\}\~]+)*$/


Report •

#2
September 27, 2009 at 09:16:59
I've worked it out, by deleting part of the code:

elseif (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $from))

By deleting the part in BOLD

Venta Sanlucar


Report •

Related Solutions


Ask Question