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

switch to Email::MIME, as MIME::Lite usage is discouraged

parent c2a457aa
Branches
Tags
No related merge requests found
...@@ -20,7 +20,8 @@ It requires the following CPAN distributions: ...@@ -20,7 +20,8 @@ It requires the following CPAN distributions:
* List-MoreUtils * List-MoreUtils
* Locale-Maketext-Lexicon * Locale-Maketext-Lexicon
* Log-Any * Log-Any
* MIME-Lite * Email-MIME
* Email-Sender
* Rose-DB-Object * Rose-DB-Object
* Template-Toolkit * Template-Toolkit
* Text-CSV * Text-CSV
......
...@@ -11,8 +11,6 @@ file = /var/log/access-check/manager.log ...@@ -11,8 +11,6 @@ file = /var/log/access-check/manager.log
level = info level = info
[mailer] [mailer]
# path to sendmail executable
sendmail_path = /usr/sbin/sendmail
# from field use by the account manager # from field use by the account manager
from = edugain-access-check.fqdn from = edugain-access-check.fqdn
......
...@@ -602,27 +602,38 @@ sub req_complete_challenge { ...@@ -602,27 +602,38 @@ sub req_complete_challenge {
$tt2->process('send_authentication_token.tt2.html', $data, \$html_content); $tt2->process('send_authentication_token.tt2.html', $data, \$html_content);
# wrap in message # wrap in message
eval "require MIME::Lite"; eval "require Email::MIME";
eval "require Encode"; eval "require Email::Sender::Simple";
my $message = MIME::Lite->new( my $email = Email::MIME->create(
From => sprintf('eduGAIN Access Check <%s>', $self->{configuration}->{mailer}->{from}), header_str => [
To => $self->{in}->{email}, 'From' => sprintf('eduGAIN Access Check <%s>', $self->{configuration}->{mailer}->{from}),
Subject => Encode::encode("MIME-Header", sprintf('[eduGAIN Access Check] %s', $self->{lh}->maketext("Test accounts request"))), 'To' => $self->{in}->{email},
Type => 'multipart/alternative', 'Subject' => sprintf('[eduGAIN Access Check] %s', $self->{lh}->maketext("Test accounts request")),
); 'Content-Type' => 'multipart/alternative'
$message->attach( ],
Type =>'text/plain', parts => [
Data => $text_content Email::MIME->create(
); attributes => {
$message->attach( content_type => "text/plain",
Type =>'text/html', charset => 'utf-8',
Data => $html_content encoding => 'quoted-printable'
},
body_str => $text_content
),
Email::MIME->create(
attributes => {
content_type => "text/html",
charset => 'utf-8',
encoding => 'quoted-printable'
},
body_str => $html_content
),
]
); );
# send message
eval { eval {
$message->send_by_sendmail(); Email::Sender::Simple->send($email);
}; };
if ($EVAL_ERROR) { if ($EVAL_ERROR) {
$self->{logger}->errorf("Mail notification error: %s", $EVAL_ERROR); $self->{logger}->errorf("Mail notification error: %s", $EVAL_ERROR);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment