There is documentation embedded in the module. (perldoc
Mail::Sendmail).
It is also accessible here:
http://alma.ch/perl/scripts/Sendmail/Sendmail.html#item_$mail{auth}
(including "{auth}" at the end, without spaces)
There is also an example in a previous thread.
How does it not work for you? Have you turned on debugging? What does
it say?
Here is another example:
#!/usr/bin/perl -w
use Mail::Sendmail;
my $VERSION = 0.1;
my %mail = (
From => '
us...@example.net',
To => '
use...@smtp.org',
Smtp => '
test.smtp.org',
Auth => {method=>'LOGIN', user=>'user07', password=>"pass07"},
Subject => 'SMTP AUTH test with LOGIN',
'X-Mailer' => "Mail::Sendmail v. $Mail::Sendmail::VERSION",
Message => 'test',
);
$Mail::Sendmail::mailcfg{debug} = 6;
print "Sending...\n";
if (sendmail %mail) {
if ($Mail::Sendmail::error) {
print "content of
\$Mail::Sendmail::error:\n$Mail::Sendmail::error\n";
}
print "OK content of
\$Mail::Sendmail::log:\n$Mail::Sendmail::log\n";
}
else {
print "\n!Error sending mail:\n$Mail::Sendmail::error\n";
}
__END__
This should give a "Relaying denied" error, because it is a test server
which does not actually send mail. But the authentication is succesful
(the server replies "235 2.0.0 OK Authenticated"). Here is the output I
got from this test script:
E:\>perl
sendmailtest.pl
Sending...
- trying
test.smtp.org
- connected to
test.smtp.org
<220
test.smtp.org ESMTP Sendmail 8.13.3 ready at Sat, 16 Jul 2005
03:29:16 -0700 (PDT); see
http://test.smtp.org/
>EHLO x31
<
250-test.smtp.org Hello xx.yy.zz [x.x.x.x], pleased to meet you
<250-ENHANCEDSTATUSCODES
<250-PIPELINING
<250-EXPN
<250-VERB
<250-8BITMIME
<250-SIZE
<250-DSN
<250-ETRN
<250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN ANONYMOUS
<250-STARTTLS
<250-DELIVERBY
<250 HELP
AUTH requested
>AUTH LOGIN
<334 VXNlcm5hbWU6
>dXNlcjA3
<334 UGFzc3dvcmQ6
>cGFzczA3
<235 2.0.0 OK Authenticated
>MAIL FROM:<
us...@example.net>
<250 2.1.0 <
us...@example.net>... Sender ok
>RCPT TO:<
use...@smtp.org>
<550 5.7.1 <
use...@smtp.org>... Relaying denied
Server said: 550 5.7.1 <
use...@smtp.org>... Relaying denied
!Error sending mail:
Bad recipient <
use...@smtp.org>: 550 5.7.1 <
use...@smtp.org>...
Relaying denied
No valid recipient
Server said: 550 5.7.1 <
use...@smtp.org>... Relaying denied