in reply to gethostbyname() and www prefix
The Examples section of POD documentation for this module even includes some notes on DNS checks on email addresses.
From this POD ...
Let's see if the address 'maurice@hevanet.com' conforms to the RFC822 specification:
print (Email::Valid->address('maurice@hevanet.com') ? 'yes' : 'no');
Additionally, let's make sure there's a mail host for it:
print (Email::Valid->address( -address => 'maurice@hevanet.com', -mxcheck => 1 ) ? 'yes' : 'no');
Let's see an example of how the address may be modified:
$addr = Email::Valid->address('Alfred Neuman <Neuman @ foo.bar>'); print "$addr\n"; # prints Neuman@foo.bar
Need to determine why an address failed?
unless(Email::Valid->address('maurice@hevanet')) { print "address failed $Email::Valid::Details check.\n"; }
If an error is encountered, an exception is raised. This is really only possible when performing DNS queries. Trap any exceptions by wrapping the call in an eval block:
eval { $addr = Email::Valid->address( -address => 'maurice@hevanet.com', -mxcheck => 1 ); }; warn "an error was encountered: $@" if $@;
Ooohhh, Rob no beer function well without!
|
|---|