Do you know where your variables are? | |
PerlMonks |
Net::SMTP halts scriptby nperrins (Initiate) |
on Jul 23, 2014 at 09:39 UTC ( [id://1094744]=perlquestion: print w/replies, xml ) | Need Help?? |
nperrins has asked for the wisdom of the Perl Monks concerning the following question: Hi Guys, This is not something I had ever considered before, but I can find no solution on the web. We have a script that loops round, does some work and sends an email with Net::SMTP. However, if the SMTP->new cannot find the mailhost, it dumps out of the whole script with an undefined mailhost error. An example of this is a simple while ( $x < 4 ) loop round an SMTP email and a print $x gives 4 emails. Change the mailhost to an incorrect name and it crashes with an "undefined" error...but doesn't go past loop 1. Is there any way of catching this and skipping it? (I know the answer is to get the mailhost name correct, but with Microsoft now blocking port 25 to relay, users can change their relay servers if and when - so having a change in relay crashing your programs is not good.)
Back to
Seekers of Perl Wisdom
|
|