Need some email check code.

They have: 62 posts

Joined: May 2000

Let's say I want to check for a valid email address. Can I have the pattern that checks it?

They have: 193 posts

Joined: Feb 2000

This code is for PERL:

unless ($INPUT{'email'} =~ /.*\@.*\..*/) {
print "invalid email format";
exit;
}
'

Hope that helped.

Richard

[email protected]

Everyone here has a website. It's just that not all are worth posting (Mine! Smiling).

They have: 122 posts

Joined: Jun 2000

Personally, I like using the Email::Valid module since it does a little bit more comprehensive test, and someone else updates it to keep it current Wink

-rob

Rob Radez
OSInvestor.com

They have: 193 posts

Joined: Feb 2000

Rob:

Please post syntax.

Richard

They have: 122 posts

Joined: Jun 2000

Use Email::Valid;
Email::Valid->address($email);

perldoc Email::Valid for more info.

-rob

They have: 193 posts

Joined: Feb 2000

Thanks.

Richard

They have: 16 posts

Joined: Aug 2000

#----------------------------------------------------------------#
# Check to see if the email address is in valid form
$valid_email = "1";
if ($email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/ ||
($email !~ /^.+\@localhost$/ &&
$email !~ /^.+\@\[?(\w|[-.])+\.[a-zA-Z]{2,3}|[0-9]{1,3}\]?$/)) {
$valid_email = "0";
}
if ($valid_email eq 1) {&error_msg('Invalid Email Address');
}

HTH
Tiffany

Tiffany Ring
Go Shoeless!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.