I would like to check the validity of an e-mail address on a form before the form is sent to me. I hate taking all the time to respond to someone just to find out they put in a bogus (or typo-ed) email address.
When I researched this once before I think there were several options / modules but I couldn't decide which was best.
I also remember thinking that I would have to get my host to load the module which would be a pain in the neck.
Am I making this harder than it needs to be?
Any recommendations on how to set this up?
if ($email_address =~ /^(\w¦\-¦\_¦\.)+\@((\w¦\-¦\_)+\.)+[a-zA-Z]{2,}$/)
{
print "$email_address is valid";
}
else {
print "$email_address is invalid";
}
Unfortunately there's no way to check if an email address actually exists apart from sending an email to it... There's a part of the SMTP protocol that provides for asking a mailserver whether or not it'd accept mail for a particular address, but as this is an easy way for spammers to obtain 'live' addresses it's rarely enabled.