Hello - I am new here and have only limited Perl experience. I have spent about four hours trying to find a solution to a simple problem I have with MIME::Lite. I just need a pointer, not lots of hand holding :-)
I'm using the brilliant MIME::Lite for sending mail and congratulate the author. However, I have a simple problem to overcome when using SMTP. It will easily give me SMTP Error that it comes across (5xx) for parsing, but I would like to get the remote server response line when it is successful (such as 250 OK message queued for delivery ABABABAB etc)
sub sendmsg {
my $mx_record = shift;
my $sender = shift;
my $recipient = shift;
my $subject = shift;
my $messagebody = shift;
my $message;
my $result;
$message = MIME::Lite->new(
Subject => $subject,
To => $recipient,
From => $sender,
Type => 'text/html',
Data => $messagebody
);
$message->replace("X-Mailer" => "Perl Mailer Override");
$message->add("X-Antiabuse" => ["anti abuse tracking", "cid:12
+34", "ccid:5678"]);
MIME::Lite->send('smtp', $mx_record, Hello => 'example.com', T
+imeout => 20);
# Send the message
eval{$message->send};
if($@) {
$result = "ERROR from MX: $mx_record\n$@\n";
} else {
$result = "OK from MX: $mx_record\n";
}
return $result;
}
My basic problem that I seek wisdom with is, how do I get at the successful server response?
Warm and kind regards
Leslie
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.