mail.pm: replace MIME::Lite by Email::Sender

* mail.pm uses Email:sender to use correct encoding on sending utf-8
encoded emails
* notify-events.cgi now uses mail.pm.
This commit is contained in:
Milan
2023-04-23 12:15:18 +02:00
parent 172e036242
commit 3effdd6ef0
3 changed files with 20 additions and 33 deletions

View File

@@ -4,22 +4,24 @@ use strict;
use warnings;
no warnings 'redefine';
use MIME::Lite();
use Email::Sender::Simple();
use Email::Simple();
sub send($) {
my $mail = shift;
my ($mail) = @_;
my $msg = MIME::Lite->new(
'From' => $mail->{'From'},
'To' => $mail->{'To'},
'Cc' => $mail->{'Cc'},
'Reply-To' => $mail->{'Reply-To'},
'Subject' => $mail->{'Subject'},
'Data' => $mail->{'Data'},
my $email = Email::Simple->create(
'Content-Type' => 'text/plain; charset=utf-8',
header => [
'From' => $mail->{'From'},
'To' => $mail->{'To'},
'Cc' => $mail->{'Cc'},
'Reply-To' => $mail->{'Reply-To'},
'Subject' => $mail->{'Subject'}
],
body => $mail->{'Data'},
);
$msg->print( \*STDERR );
$msg->send;
Email::Sender::Simple->send($email);
}
# do not delete next line