#test_mail.pl use Net::SMTP; use Net::Cmd; $smtp = Net::SMTP->new( Host => '192.168.55.173', Debug => 1, ); die "Did not connect to host..." unless defined($smtp); #you can remove this, so it would die w/ your address $smtp -> mail("root\@test-server.my.home"); @good = (); @bad = (); @mess = (); foreach $toadr (('good_address@my.home','bad_address@my.home')) { if ($smtp -> recipient( $toadr,{ SkipBad => 0, Notify => ['FAILURE']})) {; #make result boolean, 1 ::= good push( @good, $toadr ); } else { push( @bad, $toadr ); push( @mess, $smtp->message() ); } } $smtp -> data(); $smtp -> datasend("TO: good_address@my.home\n"); $smtp -> datasend("TO: bad_address@my.home\n"); $smtp -> datasend("SUBJECT: Test e-mail from root\n"); $smtp -> datasend("\n"); $smtp -> datasend("A test message.\n"); $smtp -> dataend(); print "These address(es) went: @good\n"; print "These address(es) were bad \[ and why \]:\n"; for (0..$#bad) { print "$bad[$_] \[ $mess[$_] \]\n"; } $smtp -> quit();