Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: mime lite

by Anonymous Monk
on Aug 18, 2009 at 21:02 UTC ( [id://789595]=note: print w/replies, xml ) Need Help??


in reply to Re: mime lite
in thread mime lite

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

Replies are listed 'Best First'.
Re^3: mime lite
by Anonymous Monk on Aug 18, 2009 at 22:19 UTC
    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://789595]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-24 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found