in reply to Error handling with MIME::Lite
This will trap the errors and allow you to continue processing but it doesn't tell you if $SmtpServer is invalid. An invalid host would return a message something like this:MIME::Lite->send('smtp', $SmtpServer, Timeout=>60); eval { $msg->send }; print $@ if $@; ### or do_something() if $@;
If the $SmtpServer doesn't allow relaying, you might get a message like this:Failed to connect to mail server: Invalid argument at mime.lite.p line ##
What if the server times out? If you need to do more extensive error testing you might want to try using something like Net::SMTP, which is a subclass of Net::Cmd and IO::Socket::INET to send the message.SMTP RCPT command failed:
--Jim
|
|---|