I am trying to use Net::SMTP_auth to send emails because our mail provider requires authentication.
The code (see below) works on our Linux Server that is running Perl v5.6.0 but fails authentication on our server that is running Perl v5.8.0
Any ideas on why this same code will work on Perl 5.6.0 but not on Perl 5.8.0?
Thanks in advance.
Code:
my $email = MIME::Lite->new(
From => $from_address,
To => \@to_addresses,
Cc => \@cc_addresses,
Bcc => \@bcc_addresses,
Subject => 'test',
Type => 'multipart/alternative',
);
$email->attach(Type => 'text/html',Data => "HTML Text");
$email->attach(Type => 'text/plain',Data => "Plan Text");
# get the message
my $message_body = $email->as_string();
# Create a new SMTP object
my $smtp = Net::SMTP_auth->new($host, Timeout => 60, Debug => 1) or
die "Couldn't connect to server";
my $res = $smtp->auth('LOGIN',$user_name,$password);
$smtp->mail($from_address);
$smtp->to(@to_addresses);
$smtp->cc(@cc_addresses);
$smtp->bcc(@bcc_addresses);
$smtp->data();
$smtp->datasend($message_body);
$smtp->dataend();
# Close the connection
$smtp->quit();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.