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=>60); ## the following is the offending statement $msg->send || die "MIME::Lite->send failed: $!\n"; } #### $msg = MIME::Lite->new(From=>...); $msg->send || die "you DON'T have mail!"; #### eval { $msg->send }; die "MIME::Lite->send failed: $@\n" if $@;