From 7e6f750d968054399c249357e943435e424a35b2 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Tue, 10 Jun 2014 16:17:58 +0200 Subject: [PATCH] added support for relay-only MTA (for example Nullmailer) --- lib/emailreports.pm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/emailreports.pm b/lib/emailreports.pm index 8e59da7..79e1297 100644 --- a/lib/emailreports.pm +++ b/lib/emailreports.pm @@ -26,7 +26,6 @@ use Monitorix; use MIME::Lite; use LWP::UserAgent; use Exporter 'import'; -use Switch; our @EXPORT = qw(emailreports_send); sub emailreports_send { @@ -201,15 +200,13 @@ EOF ); } - switch ($config->{method}) { - case "smtp" { - $msg->send('smtp', $emailreports->{smtp_hostname}, - Timeout => 60); - } - case "relay" { - $msg->send(); - } + if(lc($config->{method} || "") eq "relay") { + $msg->send(); + + } else { + $msg->send('smtp', $emailreports->{smtp_hostname}, Timeout => 60); } + logger("\t$myself: to: $to") if $debug; } }