diff --git a/lib/IdPAccountManager/Tools.pm b/lib/IdPAccountManager/Tools.pm index b21dbb3263f4cc40935ae1522e954903fafc9ae6..b6507fe98fcbb4af5cc856ec94a310a35ed6ab81 100644 --- a/lib/IdPAccountManager/Tools.pm +++ b/lib/IdPAccountManager/Tools.pm @@ -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 ] }, diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm index 2028a4dbc41f8721cfbac3f91445870d5dd447c0..2b107f0278a697f9eb6991deca899018cda9aa12 100755 --- a/lib/IdPAccountManager/WebRequest.pm +++ b/lib/IdPAccountManager/WebRequest.pm @@ -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}