From fb05fd63718f0ecab015bb035169633097eb7a9f Mon Sep 17 00:00:00 2001 From: Dmitrii Zolotarev Date: Wed, 4 Jun 2014 09:59:10 +0700 Subject: [PATCH] Added support for relay-only MTA (for example Nullmailer) --- lib/emailreports.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; } }