i trying to secure my script for sending mail.
I'm sending mail to a bogus server, so it fails on purpose.
MIME::Lite->send('smtp', 'mail_host', Timeout=>60);
$msg->send;
what I want is:
if $msg->send; fails, I want the script to wait an hour and then send a msg to
the administrator.
but when send fails, it send this message:
Failed to connect to mail server: Invalid argument
at C:\tmp\send_mail.pl line 146
I've tried a few things to catch this msg but none of them work. When "send"
fails, it exits the script and nothing I code after does anything.
i've tried eval(), simple if(), ignoring SIGNALS INT PIPE WARN DIE, and nothing
worked.
can someone give a hand with it???
-----------[Bullock, Howard A.] ---------------
try something like:
if (eval($msg->send)) {
$EmailSuccessCounter++;
WriteLog(LogFileName(), "Email sent successfully to $To");
}
else{
#email failure
push (@FailedEmails, [$To, $From, $Subject, $MessageText]);
WriteLog(LogFileName(), "Email failure: $To $@");
$EmailFailureCounter++;
}
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs