From 2d81ab7fdf7b573c9654519e2066701675ee9675 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Wed, 18 Jan 2017 11:38:40 +0100 Subject: [PATCH] fixed in 'emailreports.pm' to name each attached graph correctly. #174 --- lib/emailreports.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/emailreports.pm b/lib/emailreports.pm index 7c03d8a..c313ae7 100644 --- a/lib/emailreports.pm +++ b/lib/emailreports.pm @@ -32,6 +32,7 @@ sub emailreports_send { my $myself = (caller(0))[3]; my ($config, $report, $when, $debug) = @_; my $emailreports = $config->{emailreports}; + my $imgfmt_lc = lc($config->{image_format}); my $base_cgi = $config->{base_cgi}; my $imgs_dir = $config->{imgs_dir}; @@ -131,14 +132,12 @@ EOF $n = 1; foreach (split('\n', $graph)) { if(/"); - $images->{"image_$g$n"} = ""; - + push(@tmp, ""); ($url) = $_ =~ m/new($url); my $path = $uri->path || ""; $response = $ua->request(HTTP::Request->new('GET', "$prefix$path")); - $images->{"image_$g$e$n"} = $response->content; + $images->{"image_$g$e$n.$imgfmt_lc"} = $response->content; $n++; } else { push(@tmp, $_); @@ -199,7 +198,7 @@ EOF ); while (my ($key, $val) = each(%{$images})) { $msg->attach( - Type => $mime, + Type => "$mime; name=\"$key\"", Id => $key, Data => $val, );