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
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,8 @@ It requires the following CPAN distributions:
* List-MoreUtils
* Locale-Maketext-Lexicon
* Log-Any
* MIME-Lite
* Email-MIME
* Email-Sender
* Rose-DB-Object
* Template-Toolkit
* Text-CSV
......
......@@ -11,8 +11,6 @@ file = /var/log/access-check/manager.log
level = info
[mailer]
# path to sendmail executable
sendmail_path = /usr/sbin/sendmail
# from field use by the account manager
from = edugain-access-check.fqdn
......
......@@ -602,27 +602,38 @@ sub req_complete_challenge {
$tt2->process('send_authentication_token.tt2.html', $data, \$html_content);
# wrap in message
eval "require MIME::Lite";
eval "require Encode";
my $message = MIME::Lite->new(
From => sprintf('eduGAIN Access Check <%s>', $self->{configuration}->{mailer}->{from}),
To => $self->{in}->{email},
Subject => Encode::encode("MIME-Header", sprintf('[eduGAIN Access Check] %s', $self->{lh}->maketext("Test accounts request"))),
Type => 'multipart/alternative',
);
$message->attach(
Type =>'text/plain',
Data => $text_content
);
$message->attach(
Type =>'text/html',
Data => $html_content
eval "require Email::MIME";
eval "require Email::Sender::Simple";
my $email = Email::MIME->create(
header_str => [
'From' => sprintf('eduGAIN Access Check <%s>', $self->{configuration}->{mailer}->{from}),
'To' => $self->{in}->{email},
'Subject' => sprintf('[eduGAIN Access Check] %s', $self->{lh}->maketext("Test accounts request")),
'Content-Type' => 'multipart/alternative'
],
parts => [
Email::MIME->create(
attributes => {
content_type => "text/plain",
charset => 'utf-8',
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 {
$message->send_by_sendmail();
Email::Sender::Simple->send($email);
};
if ($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.
Finish editing this message first!
Please register or to comment