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:

#!/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"; }
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.

OK... so I modified it and ran it again.

#!/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";
and this ran without problems.

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

MIME::Lite->send("smtp","localhost",Port=>9925);
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! :-)


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

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

    When I tried the eval{} the code was probably a bit different from what I posted, the code might have had some other error so I probably thought it was the eval as it was the first time I've used it Thank you for your time