Hello Dear Monks
My emails are sent with Net::SMTP but rejected using MIME::Lite.
test code :
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=> $pas
+s , Debug=>4 );
output :
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 s
+ystem 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.lo
+caldomain [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 <replaced> <--------------
Net::SMTP=GLOB(0x1acbc24)<<< 235 Authentication succeeded <-------
Net::SMTP=GLOB(0x1acbc24)>>> MAIL FROM:<inlook@example.ch>
Net::SMTP=GLOB(0x1acbc24)<<< 250 OK
Net::SMTP=GLOB(0x1acbc24)>>> RCPT TO:<andre@example.ch>
Net::SMTP=GLOB(0x1acbc24)<<< 250 Accepted
Net::SMTP=GLOB(0x1acbc24)>>> DATA
Net::SMTP=GLOB(0x1acbc24)<<< 354 Enter message, ending with "." on a l
+ine 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 local
+host.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:<inlook@example.ch>
MIME::Lite::SMTP=GLOB(0x1b05044)<<< 250 OK
MIME::Lite::SMTP=GLOB(0x1b05044)>>> RCPT TO:<andre@example.ch>
MIME::Lite::SMTP=GLOB(0x1b05044)<<< 550-Mail rejected - 69.94.202.62.c
+ust.bluewin.ch (localhost.localdomain)
MIME::Lite::SMTP=GLOB(0x1b05044)<<< 550 [62.202.94.69] is in an RBL, s
+ee 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=6
+2.202.94.69
at E:\www\alna-dev\cgi-bin\inlook\test.pl line 47
E:\www\alna-dev\cgi-bin\inlook>
It seems the authentication (<--) is not sent when using Lite. Right ?
I'm on XP, perl 5.8.8
I read in the docs about libnet.cfg which I don't have, but as I specify $smtp_server do I really need it ?
Thanks.
Have a nice day.
"There is only one good, namely knowledge, and only one evil, namely ignorance." Socrates
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.