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

drop recipient filtering code, mails are sent to admins only anyway

parent abbcbfdb
No related branches found
No related tags found
No related merge requests found
......@@ -114,45 +114,12 @@ sub mail_notice {
my $mail_data = $args{data};
my $logger = $args{logger};
my $notice_email = $args{to} || $args{admin_email};
$mail_data->{to} = $notice_email;
## Protection to prevent notifications during test dev phases
## Notify only admin_email or dev_sp_contact addresses
if ($args{dev_no_mail_outside}) {
my %rcpt = map { $_ => 1 } split(/,/, $notice_email);
my %authorized_rcpt = map { $_ => 1 } split(
/,/,
join(',',
$args{admin_email},
$args{dev_sp_contact})
);
my $change_rcpt = 0;
foreach my $email (keys %rcpt) {
unless ($authorized_rcpt{$email}) {
$change_rcpt = 1;
last;
}
}
if ($change_rcpt) {
$logger->infof(
"no_mail_outside option set; notification for %s rerouted to admins ; ",
$notice_email
);
$notice_email = $args{admin_email};
}
}
$logger->tracef(
sprintf('(template=%s, to=%s)', $args{template}, $mail_data->{to})
sprintf('(template=%s, to=%s)', $args{template}, $args{to})
);
open SENDMAIL,
"|/usr/sbin/sendmail -f "
. $args{notice_from}
. " $notice_email";
"|/usr/sbin/sendmail -f $args{from} $args{to}";
my $tt2 = Template->new({
FILTERS => { qencode => [ \&qencode, 0 ] },
......
......@@ -186,14 +186,12 @@ sub respond {
if (@errors_admin) {
$self->{out}->{subject} = 'Error notification - web interface';
IdPAccountManager::Tools::mail_notice(
template => 'mail/notification_generic_error.tt2.eml',
templates_dir => $self->{configuration}->{templates_dir},
data => $self->{out},
logger => $self->{logger},
admin_email => $self->{configuration}->{admin_email},
dev_no_mail_outside => $self->{configuration}->{dev_no_mail_outside},
dev_sp_contact => $self->{configuration}->{dev_sp_contact},
notice_from => $self->{configuration}->{notice_from}
template => 'mail/notification_generic_error.tt2.eml',
templates_dir => $self->{configuration}->{templates_dir},
data => $self->{out},
logger => $self->{logger},
to => $self->{configuration}->{admin_email},
from => $self->{configuration}->{notice_from}
);
}
}
......@@ -414,6 +412,7 @@ sub req_generate_token {
IdPAccountManager::Tools::mail_notice(
template => 'mail/send_authentication_token.tt2.eml',
templates_dir => $self->{configuration}->{templates_dir},
from => $self->{configuration}->{notice_from}
to => $self->{in}->{email_address},
data => $self->{out},
logger => $self->{logger}
......
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