in reply to MIME::Lite aborting when it receives an error
More details please. What do you mean by "the code dies."
I made an attempt at replicating what you are saying based on face value. Conisder the following code:
In my test I used one real address, and one bogus address. The loop sends to the bogus address first. It runs, no errors, no problems.#!/usr/bin/perl -w $|=1; use strict; use MIME::Lite; my @addrs=qw/ nobody@nowhere.com my_real_mail@myisp.com /; # # This is one bogus email address and one good # email address. The good address has been sanitized # for this posting. foreach my $addr(@addrs){ printf "Sending email to %s...",$addr; my $msg = MIME::Lite -> new ( From => 'my-return@isp.com', To => $addr, Subject => 'this is a test', Type=> 'TEXT', Data => 'test 1 2 3...' ); MIME::Lite->send("smtp","localhost",Port=>9925); $msg->send; printf "Message sent.\n"; }
OK... so I modified it and ran it again.
and this ran without problems.#!/usr/bin/perl -w $|=1; use strict; use MIME::Lite; my @addrs=qw/ nobody@nowhere.com me@my-isp.net /; my $msg = MIME::Lite -> new ( From => 'me@my-isp.ne', To => join(",",@addrs), Subject => 'this is a test', Type=> 'TEXT', Data => 'test 1 2 3...' ); MIME::Lite->send("smtp","localhost",Port=>9925); $msg->send; printf "Message sent.\n";
Now, in both cases the SMTP server complained to me that the address was bogus, but the mail still went to the legit address...
So, now I'm confused. What kind of errors are you seeing?
Before you think there is some sort of magic foo involved with the line
there isn't. This is there because my laptop does not send mail through its native sendmail instance but instead uses an SSH tunnel to send email through my main server at home. Makes configuration of my laptop easier! :-)MIME::Lite->send("smtp","localhost",Port=>9925);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: MIME::Lite aborting when it receives an error
by PugSA (Beadle) on Jun 30, 2006 at 16:07 UTC |