use strict; use warnings; use Net::SMTP; use MIME::Lite; my $smtp_server = 'mail.example.ch'; my $from = 'inlook@example.ch'; my $to = 'andre@example.ch'; my $pass = 'example'; my $smtp = Net::SMTP->new( "$smtp_server" , Timeout => 10 , Debug => 4 ) or die $!; $smtp->auth ( $from , $pass ) or die "Could not authenticate $!"; $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend("From: $from\n"); $smtp->datasend("To: $to\n"); $smtp->datasend("Subject: test\n\n"); $smtp->datasend("test"); $smtp->dataend(); $smtp->quit; ### Create a new multipart message: my $msg = MIME::Lite->new( From => $from , To => $to , Subject => 'test', Data => "test" ); $msg->send( 'smtp' , $smtp_server , AuthUser=> $from , AuthPass=> $pass , Debug=>4 ); #### E:\www\alna-dev\cgi-bin\inlook>test.pl Net::SMTP>>> Net::SMTP(2.30) Net::SMTP>>> Net::Cmd(2.27) Net::SMTP>>> Exporter(5.60) Net::SMTP>>> IO::Socket::INET(1.31) Net::SMTP>>> IO::Socket(1.30) Net::SMTP>>> IO::Handle(1.27) Net::SMTP=GLOB(0x1acbc24)<<< 220-server8.example.ch ESMTP Exim 4.68 #1 Mon, 21 Apr 2008 10:14:47 +0200 Net::SMTP=GLOB(0x1acbc24)<<< 220-We do not authorize the use of this system to transport unsolicited, Net::SMTP=GLOB(0x1acbc24)<<< 220 and/or bulk e-mail. Net::SMTP=GLOB(0x1acbc24)>>> EHLO localhost.localdomain Net::SMTP=GLOB(0x1acbc24)<<< 250-server8.example.ch Hello localhost.localdomain [62.202.94.69] Net::SMTP=GLOB(0x1acbc24)<<< 250-SIZE 52428800 Net::SMTP=GLOB(0x1acbc24)<<< 250-PIPELINING Net::SMTP=GLOB(0x1acbc24)<<< 250-AUTH PLAIN LOGIN Net::SMTP=GLOB(0x1acbc24)<<< 250 HELP Net::SMTP=GLOB(0x1acbc24)>>> AUTH PLAIN <-------------- Net::SMTP=GLOB(0x1acbc24)<<< 235 Authentication succeeded <------- Net::SMTP=GLOB(0x1acbc24)>>> MAIL FROM: Net::SMTP=GLOB(0x1acbc24)<<< 250 OK Net::SMTP=GLOB(0x1acbc24)>>> RCPT TO: Net::SMTP=GLOB(0x1acbc24)<<< 250 Accepted Net::SMTP=GLOB(0x1acbc24)>>> DATA Net::SMTP=GLOB(0x1acbc24)<<< 354 Enter message, ending with "." on a line by itself Net::SMTP=GLOB(0x1acbc24)>>> From: inlook@example.ch Net::SMTP=GLOB(0x1acbc24)>>> To: andre@example.ch Net::SMTP=GLOB(0x1acbc24)>>> Subject: test Net::SMTP=GLOB(0x1acbc24)>>> test Net::SMTP=GLOB(0x1acbc24)>>> . Net::SMTP=GLOB(0x1acbc24)<<< 250 OK id=1JnrAl-00066w-Q2 Net::SMTP=GLOB(0x1acbc24)>>> QUIT Net::SMTP=GLOB(0x1acbc24)<<< 221 server8.example.ch closing connection MIME::Lite::SMTP>>> MIME::Lite::SMTP MIME::Lite::SMTP>>> Net::SMTP(2.30) MIME::Lite::SMTP>>> Net::Cmd(2.27) MIME::Lite::SMTP>>> Exporter(5.60) MIME::Lite::SMTP>>> IO::Socket::INET(1.31) MIME::Lite::SMTP>>> IO::Socket(1.30) MIME::Lite::SMTP>>> IO::Handle(1.27) MIME::Lite::SMTP=GLOB(0x1b05044)<<< 220-server8.example.ch ESMTP Exim 4.68 #1 Mon, 21 Apr 2008 10:14:50 +0200 MIME::Lite::SMTP=GLOB(0x1b05044)<<< 220-We do not authorize the use of this system to transport unsolicited, MIME::Lite::SMTP=GLOB(0x1b05044)<<< 220 and/or bulk e-mail. MIME::Lite::SMTP=GLOB(0x1b05044)>>> EHLO localhost.localdomain MIME::Lite::SMTP=GLOB(0x1b05044)<<< 250-server8.example.ch Hello localhost.localdomain [62.202.94.69] MIME::Lite::SMTP=GLOB(0x1b05044)<<< 250-SIZE 52428800 MIME::Lite::SMTP=GLOB(0x1b05044)<<< 250-PIPELINING MIME::Lite::SMTP=GLOB(0x1b05044)<<< 250-AUTH PLAIN LOGIN MIME::Lite::SMTP=GLOB(0x1b05044)<<< 250 HELP MIME::Lite::SMTP=GLOB(0x1b05044)>>> MAIL FROM: MIME::Lite::SMTP=GLOB(0x1b05044)<<< 250 OK MIME::Lite::SMTP=GLOB(0x1b05044)>>> RCPT TO: MIME::Lite::SMTP=GLOB(0x1b05044)<<< 550-Mail rejected - 69.94.202.62.cust.bluewin.ch (localhost.localdomain) MIME::Lite::SMTP=GLOB(0x1b05044)<<< 550 [62.202.94.69] is in an RBL, see http://www.spamhaus.org/query/bl?ip=62.202.94.69 SMTP RCPT command failed: Mail rejected - 69.94.202.62.cust.bluewin.ch (localhost.localdomain) [62.202.94.69] is in an RBL, see http://www.spamhaus.org/query/bl?ip=62.202.94.69 at E:\www\alna-dev\cgi-bin\inlook\test.pl line 47 E:\www\alna-dev\cgi-bin\inlook>