slugger415 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, this may be a DQ (dumb question), but how do I capture a failure to connect to the SMTP server when using Email::Sender?
I've tried to capture the results in a variable:
$RES = sendmail($email, { transport => $transport });When it connects to $transport everything works fine, but occasionally it doesn't connect, and I see "unable to connect to SMTP server" and a bunch of trace messages. Those messages don't get put into $RES so the script can't tell if it's failed, and I can't code some appropriate behavior.
============================= unable to establish SMTP connection Trace begun at C:\strawberry\perl\site\lib\Email\Sender\Transport\SMTP +.pm line 6 Email::Sender::Transport::SMTP::_throw('Email::Sender::Transport::SMTP +=HASH(0x3 fcb9c)', 'unable to establish SMTP connection') called at C:\strawberr +y\perl\si e\lib\Email\Sender\Transport\SMTP.pm line 63 etc.... ==========================
In fact it seems that the script crashes when this happens and doesn't continue.
I've done some homework on how to catch errors but must be missing something here.
thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to capture failure of Email::Sender
by daxim (Curate) on Aug 27, 2013 at 16:38 UTC | |
by slugger415 (Monk) on Aug 27, 2013 at 18:03 UTC |