Users using the Tequila login are invited to migrate to gitlab.epfl.ch. This instance will close for Tequila users by May 2020.

Commit f6c7fc30 authored by Florian Vessaz's avatar Florian Vessaz

Use Email::Simple instead of Mail::Sender

parent 96fe50ee
Pipeline #1258 passed with stage
in 4 minutes and 59 seconds
......@@ -9,9 +9,10 @@ test:
libdancer-perl
libdancer-session-cookie-perl
libdbi-perl
libemail-sender-perl
libemail-simple-perl
libemail-valid-perl
libjson-perl
libmail-sender-perl
libnet-ldap-perl
libplack-perl
libtemplate-perl
......
......@@ -20,6 +20,8 @@ WriteMakefile(
'Dancer' => 1.3132,
'Dancer::Session::Cookie' => 0,
'DBI' => 0,
'Email::Simple' => 0,
'Email::Sender' => 0,
'Email::Valid' => 0,
'JSON' => 0,
'Mail::Sender' => 0,
......
......@@ -2,8 +2,8 @@ package mail;
use strict;
use Dancer ':syntax';
use Encode;
use Mail::Sender;
use Email::Sender::Simple qw(sendmail);
use Email::Simple;
sub send_welcome_mail {
my %args = @_;
......@@ -17,19 +17,17 @@ sub send_welcome_mail {
member_link => 'https://members.gnugen.ch/member/' . $username,
}, {layout => undef});
my $sender = new Mail::Sender {
smtp => 'localhost',
from => 'comite@gnugen.ch',
bcc => 'comite@gnugen.ch',
on_errors => undef,
};
ref($sender->MailMsg({
charset => 'utf8',
encoding => 'quoted-printable',
to => $recipient,
subject => 'Welcome to GNU Generation',
msg => encode('utf8', $msg),
})) or warn "Couldn't send mail: " . $Mail::Sender::Error;
my $mail = Email::Simple->create(
header => [
From => 'comite@gnugen.ch',
To => $recipient,
Bcc => 'comite@gnugen.ch',
Subject => 'Welcome to GNU Generation',
],
body => $msg,
);
sendmail($mail);
}
sub send_password_reset {
......@@ -43,18 +41,16 @@ sub send_password_reset {
reset_link => 'https://members.gnugen.ch' . $args{password_link},
}, {layout => undef});
my $sender = new Mail::Sender {
smtp => 'localhost',
from => 'root@gnugen.ch',
on_errors => undef,
};
ref($sender->MailMsg({
charset => 'utf8',
encoding => 'quoted-printable',
to => $recipient,
subject => "GNU Generation account's pasword reset",
msg => encode('utf8', $msg),
})) or warn "Couldn't send mail: " . $Mail::Sender::Error;
my $mail = Email::Simple->create(
header => [
From => 'root@gnugen.ch',
To => $recipient,
Subject => 'GNU Generation password reset',
],
body => $msg,
);
sendmail($mail);
}
1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment