mirror of https://github.com/mikaku/Monitorix.git
fixed the MIME type in 'emailreports.pm' to honor the 'image_format' option. #174
This commit is contained in:
parent
b3b85b774e
commit
2e4349505f
|
@ -36,6 +36,7 @@ sub emailreports_send {
|
|||
my $base_cgi = $config->{base_cgi};
|
||||
my $imgs_dir = $config->{imgs_dir};
|
||||
my $images;
|
||||
my $mime;
|
||||
|
||||
logger("$myself: sending $report reports.");
|
||||
|
||||
|
@ -48,6 +49,9 @@ sub emailreports_send {
|
|||
|
||||
my $prefix = "$scheme://$userinfo$hostname:$port";
|
||||
|
||||
$mime = "image/png";
|
||||
$mime = "image/svg+xml" if uc($config->{image_format}) eq "SVG";
|
||||
|
||||
my $html = <<"EOF";
|
||||
<html>
|
||||
<body bgcolor='FFFFFF' vlink='#888888' link='#888888'>
|
||||
|
@ -195,7 +199,7 @@ EOF
|
|||
);
|
||||
while (my ($key, $val) = each(%{$images})) {
|
||||
$msg->attach(
|
||||
Type => 'image/png',
|
||||
Type => $mime,
|
||||
Id => $key,
|
||||
Data => $val,
|
||||
);
|
||||
|
|
|
@ -320,6 +320,7 @@ sub traffacct_sendreports {
|
|||
|
||||
my (undef, undef, undef, undef, $prev_month, $prev_year) = localtime(time - 3600);
|
||||
my $n;
|
||||
my $mime;
|
||||
|
||||
my $usage_dir = $config->{base_lib} . $config->{usage_dir};
|
||||
my $report_dir = $config->{base_lib} . $config->{report_dir};
|
||||
|
@ -327,6 +328,9 @@ sub traffacct_sendreports {
|
|||
my $base_cgi = $config->{base_cgi};
|
||||
my $imgs_dir = $config->{imgs_dir};
|
||||
|
||||
$mime = "image/png";
|
||||
$mime = "image/svg+xml" if uc($config->{image_format}) eq "SVG";
|
||||
|
||||
logger("Sending monthly network traffic reports.");
|
||||
|
||||
my @tal = split(',', $traffacct->{list});
|
||||
|
@ -398,7 +402,7 @@ sub traffacct_sendreports {
|
|||
Path => $config->{base_dir} . $config->{logo_bottom},
|
||||
);
|
||||
$msg->attach(
|
||||
Type => 'image/png',
|
||||
Type => $mime,
|
||||
Id => 'image_02',
|
||||
Data => $image->content,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue