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

In reply to Re: MIME::Lite aborting when it receives an error by blue_cowdawg
in thread MIME::Lite aborting when it receives an error by PugSA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.