I just found the following code "laying around" in one of my programs.
(It's stolen though, but I forget whom to give credit to) What
do you guys think about adding it in?
It DOES require the domain name to be broken up into pieces, and I have
code that does that -- but it's broken (it will only work with domain
names that have only one period -- so that will have to be fixed)
Such code could be used during the subscribe procedure.
sub domainresolve {
# Resolve IP if needed
if ($email_domain =~ /\d+\.\d+\.\d+\.\d+/) {
if ($dnscache{$email_domain}) {
$email_domain=$dnscache{$email_domain};
$cachehits++; }
else {
($domain,$junk)=gethostbyaddr(pack('C4',split(/\./,$email_domain)),2);
($domain)?($ipresolved++):($domain=$email_domain);
$dnscache{$email_domain} = $domain;
$email_domain=$domain;
}
}
# Get the domain, if there is one.
($domain) = ($email_domain =~ /([^\.]+\.[^\d\.]+)$/o);
($domain) || ($domain = "$email_domain") & ($valid_addr = 'ipbad');
$email_domain = $domain;
}
sub divide_addr {
($email_name, $email_domain) = split(/\@/, $email);
}
sub undivide_addr {
if ($email =~ /\@/) {
$email = "$email_name" . '@' . "$email_domain";
} else {
$email = "$email_name";
}
}
-------------------------------------------------------------------------
| Brock Rozen | brozen@webdreams.com | http://www.webdreams.com/~brozen |
-------------------------------------------------------------------------
Follow-Ups:
|
|