2011-07-29 Koichiro Kikuchi <koichiro@rworks.jp>

* lib/PandoraFMS/Tools.pm: Send utf8 email properly.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4648 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
koichirok 2011-07-29 05:12:28 +00:00
parent d59490995c
commit 5e61380e76
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2011-07-29 Koichiro Kikuchi <koichiro@rworks.jp>
* lib/PandoraFMS/Tools.pm: Send utf8 email properly.
2011-07-27 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Config.pm: Read configuration for the new enterprise

View File

@ -23,6 +23,7 @@ use POSIX qw(setsid strftime);
use POSIX;
use PandoraFMS::Sendmail;
use HTML::Entities;
use Encode;
# New in 3.2. Used to sendmail internally, without external scripts
# use Module::Loaded;
@ -333,13 +334,20 @@ sub pandora_sendmail {
my %mail = ( To => $to_address,
Message => $message,
Subject => $subject,
Subject => encode('MIME-Header', $subject),
'X-Mailer' => "Pandora FMS",
Smtp => $pa_config->{"mta_address"},
Port => $pa_config->{"mta_port"},
From => $pa_config->{"mta_from"},
);
# Check if message has non-ascii chars.
# non-ascii chars should be encoded in UTF-8.
if ($message =~ /[^[:ascii:]]/o) {
$mail{Message} = encode("UTF-8", $mail{Message});
$mail{'Content-Type'} = 'text/plain; charset="UTF-8"';
}
if ($pa_config->{"mta_user"} ne ""){
$mail{auth} = {user=>$pa_config->{"mta_user"}, password=>$pa_config->{"mta_pass"}, method=>$pa_config->{"mta_auth"}, required=>1 };
}