[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] Sending Mail in perl




Guys/Gals,


Here is a snippet using Net::DNS to get the MX record
of an email address.  From that point forward, you can
use Geoff's script as well as Net::SMTP to send an
email directly to that address and avoid using 
a local relay.


---------------------------------
#!/usr/bin/perl

use Net::DNS;
die "$0 <email addr>\n" unless $ARGV[0];
$ARGV[0]=~ /.*\@(.*)/;
die "can not get domain\n" unless $1;
my @mx = mx($1);
foreach $rec (@mx) {
    print $rec->preference." ".$rec->exchange."\n";
}

# vi: set ts=4 sw=4 : 
---------------------------------

Chris

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale