>You know, if I keep this up, I'll get you to write an entire email
>address parser in Perl. ;-)
>
>But (all together now) That Would Be Wrong.
*laugh*
just for that, here's a version that runs the address through the local
version of sendmail to check its structure (why try to duplicate the MTA
when you can just query it?), then looks for mail exchangers:
#!/usr/local/bin/perl
$addr = $ARGV[0];
$ck = `sendmail -bv $addr`;
($status, $domain) = $ck =~ /(\S+): .* host (\S+),/;
if ($status eq 'deliverable') {
$l = `nslookup -type=mx $domain`;
@mx = $l =~ /mail exchanger = (\S+)/g;
if (0 == @mx) {
print "the domain $domain has no mail exchanger.\n";
}
for $item (@mx) {
@A = gethostbyname($item);
print "name = $A[0]\n";
print "aliases = $A[1]\n";
print "type = $A[2]\n";
print "length = $A[3]\n";
print "address = ", join ('.', unpack ('C4', $A[4])), "\n\n";
}
} else {
print "$addr is undeliverable";
}
NOTE: this only verifies the structure of the address and the existence of
the mailserver. it doesn't make the query which would determine whether
or not that user actually exists. That Would Be Harder. ;-)
mike stone <[EMAIL PROTECTED]> 'net geek..
been there, done that, have network, will travel.
____________________________________________________________________
--------------------------------------------------------------------
Join The Web Consultants Association : Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------