diff --git a/lib/emailreports.pm b/lib/emailreports.pm index 8530118..8e59da7 100644 --- a/lib/emailreports.pm +++ b/lib/emailreports.pm @@ -26,6 +26,7 @@ use Monitorix; use MIME::Lite; use LWP::UserAgent; use Exporter 'import'; +use Switch; our @EXPORT = qw(emailreports_send); sub emailreports_send { @@ -200,7 +201,15 @@ EOF ); } - $msg->send('smtp', $emailreports->{smtp_hostname}, Timeout => 60); + switch ($config->{method}) { + case "smtp" { + $msg->send('smtp', $emailreports->{smtp_hostname}, + Timeout => 60); + } + case "relay" { + $msg->send(); + } + } logger("\t$myself: to: $to") if $debug; } }