Skip to content
Snippets Groups Projects
Commit d28f572c authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

MIME-encode emails headers if needed

parent d10a619f
Branches
Tags
No related merge requests found
...@@ -5,6 +5,7 @@ use warnings; ...@@ -5,6 +5,7 @@ use warnings;
use CGI; use CGI;
use DateTime; use DateTime;
use Encode;
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Log::Any::Adapter; use Log::Any::Adapter;
use List::MoreUtils qw(uniq); use List::MoreUtils qw(uniq);
...@@ -590,7 +591,8 @@ sub req_complete_challenge { ...@@ -590,7 +591,8 @@ sub req_complete_challenge {
my $tt2 = Template->new({ my $tt2 = Template->new({
ENCODING => 'utf8', ENCODING => 'utf8',
PRE_CHOMP => CHOMP_ONE, PRE_CHOMP => CHOMP_ONE,
INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/mail" INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/mail",
FILTERS => { mime => [ sub { return encode("MIME-Header", $_[0]); }, 0 ] },
}); });
my $template = 'send_authentication_token.tt2.eml'; my $template = 'send_authentication_token.tt2.eml';
my $data = { my $data = {
......
From: eduGAIN Access Check <[% from %]> From: eduGAIN Access Check <[% from %]>
To: [% to %] To: [% to %]
Subject: eduGAIN Access Check - [% lh.maketext("Test accounts request") %] Subject: eduGAIN Access Check - [% lh.maketext("Test accounts request") | mime %]
Content-type: text/plain; charset=UTF-8; format=flowed Content-type: text/plain; charset=UTF-8; format=flowed
[% lh.maketext("This is an email challenge automatically sent to you by eduGAIN Access Check.") %] [% lh.maketext("This is an email challenge automatically sent to you by eduGAIN Access Check.") %]
......
From: eduGAIN Access Check <[% from %]> From: eduGAIN Access Check <[% from %]>
To: [% to %] To: [% to %]
Subject: eduGAIN Access Check - [% lh.maketext("Test accounts request") %] Subject: eduGAIN Access Check - [% lh.maketext("Test accounts request") | mime %]
Content-type: text/plain; charset=UTF-8; format=flowed Content-type: text/plain; charset=UTF-8; format=flowed
[% lh.maketext("This is an email challenge automatically sent to you by eduGAIN Access Check.") %] [% lh.maketext("This is an email challenge automatically sent to you by eduGAIN Access Check.") %]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment