The correct address should be of the form '"some name" <anyone@somewhere.com>'. In the above code the program dies with an smtp message but does not display the intended die message. The statement is patterned after the MIME::Lite documentation example:sub Send_Msg { my ($to, $from, $subject, $body) = @_; use MIME::Lite; my $msg = new MIME::Lite To => '"some name" anyone@somewhere.com', From => $from, Subject => $subject, Type => 'TEXT', Data => $body; MIME::Lite->send('smtp', "some_valid_smtp_server_name", Timeout=>6 +0); ## the following is the offending statement $msg->send || die "MIME::Lite->send failed: $!\n"; }
As an instance method with no arguments, sends the message by the default mechanism set up by the class method. Returns whatever the mail-handling routine returns: this should be true on success, false/exception on error:
However replacing the offending line with the following works correctly:$msg = MIME::Lite->new(From=>...); $msg->send || die "you DON'T have mail!";
Does this reflect your experience and if so, is it worth notifying the module author? Thanks.eval { $msg->send }; die "MIME::Lite->send failed: $@\n" if $@;
--Jim
In reply to MIME::Lite error handling by jlongino
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |