This code was borrowed from a few other places, so it still had the
$stat variable, but wasn't doing anything with it. We might as well
go a step further and borrow the error handling that variable is there
for.
Ultimately, email handling should probably moved out to a utility
function rather than spread about.
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
$stat = $sender->send($email);
} catch Error with {
$err = $stat = shift;
- $logger->error("resend_at_email: Email failed with error: $err");
+ $logger->error("send_event_email_output: Email failed with error: $err");
};
- return undef;
+ if( !$err and $stat and $stat->type eq 'success' ) {
+ $logger->info("send_event_email_output: successfully sent email");
+ return 1;
+ } else {
+ $logger->warn("send_event_email_output: unable to send email: ".Dumper($stat));
+ return 0;
+ }
}
__PACKAGE__->register_method(