Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: mime lite

by Anonymous Monk
on Apr 27, 2009 at 18:31 UTC ( [id://760395]=note: print w/replies, xml ) Need Help??


in reply to mime lite

See MIME::Lite to learn how to add error checking and turn on debugging.

Replies are listed 'Best First'.
Re^2: mime lite
by Anonymous Monk on Aug 18, 2009 at 21:02 UTC
    I am trying to add error checking for Mime::Lite too, however the documentation only shows this:
    $msg->send || die "you DON'T have mail!";
    however that does not say what was wrong, it does not give the exception error, so that we know what happened, other than it did not send the email, which would be obvious if we did this:
    if($msg->send()) { # Say that the message was sent... or if in a subroutine just: return 1; } else { # Give error message but what do we show to actually put what happene +d? if in a subroutine return 0; but set an error such as: #$Mime::Lite::error or something similar... }

    Any clues how to get the errors message to figure out what went wrong?

    Thanks
      I found something that may work, however, the way he was handling it was a little different that what I need: using Test::Trap

      What will make this work?
      use Test::Trap qw/ :output(systemsafe) /; $_sendError = ""; trap { $msg->send('smtp', 'mail.wholewellnessclub.com', AuthUser=> +'somemailuser@somedomain.com', AuthPass=>'$_encEmPass') || $_sendErro +r = $@ }; $_ and $_sendError = $_ for $trap->die, $trap->stdout, $trap->stde +rr; if($_sendError) { return 0; } else { return 1; }
      I don't want to print anything, I just need to catch the error IN a variable so that I can have my system continue. It emails me any errors that the programming catches.

      Thank you for any advice you can offer for this to work.
      Right now I get this error:
      Can't modify logical or (||) in scalar assignment at /path/to/data/fil +e/Send_Mime_Lite_Email.data line 39, near "$@ }" # That code is above...
      Thanks again in advance.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://760395]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-29 13:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found