mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
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:
parent
b9f6b512a9
commit
2c18dc6643
@ -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>
|
2011-07-27 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* lib/PandoraFMS/Config.pm: Read configuration for the new enterprise
|
* lib/PandoraFMS/Config.pm: Read configuration for the new enterprise
|
||||||
|
@ -23,6 +23,7 @@ use POSIX qw(setsid strftime);
|
|||||||
use POSIX;
|
use POSIX;
|
||||||
use PandoraFMS::Sendmail;
|
use PandoraFMS::Sendmail;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
|
use Encode;
|
||||||
|
|
||||||
# New in 3.2. Used to sendmail internally, without external scripts
|
# New in 3.2. Used to sendmail internally, without external scripts
|
||||||
# use Module::Loaded;
|
# use Module::Loaded;
|
||||||
@ -333,13 +334,20 @@ sub pandora_sendmail {
|
|||||||
|
|
||||||
my %mail = ( To => $to_address,
|
my %mail = ( To => $to_address,
|
||||||
Message => $message,
|
Message => $message,
|
||||||
Subject => $subject,
|
Subject => encode('MIME-Header', $subject),
|
||||||
'X-Mailer' => "Pandora FMS",
|
'X-Mailer' => "Pandora FMS",
|
||||||
Smtp => $pa_config->{"mta_address"},
|
Smtp => $pa_config->{"mta_address"},
|
||||||
Port => $pa_config->{"mta_port"},
|
Port => $pa_config->{"mta_port"},
|
||||||
From => $pa_config->{"mta_from"},
|
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 ""){
|
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 };
|
$mail{auth} = {user=>$pa_config->{"mta_user"}, password=>$pa_config->{"mta_pass"}, method=>$pa_config->{"mta_auth"}, required=>1 };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user