Merge remote-tracking branch 'calcms/master'

* notify-events.cgi: write result to response
* mail.pm: encode body by quoted printable
This commit is contained in:
www-data
2024-02-15 21:11:43 +01:00
2 changed files with 6 additions and 5 deletions

View File

@@ -3,26 +3,26 @@ package mail;
use strict; use strict;
use warnings; use warnings;
no warnings 'redefine'; no warnings 'redefine';
use utf8;
use Email::Sender::Simple(); use Email::Sender::Simple();
use Email::Simple(); use Email::Simple();
use MIME::Words qw(encode_mimeword); use MIME::Words qw(encode_mimeword);
use Encode; use MIME::QuotedPrint qw(encode_qp);
sub send($) { sub send($) {
my ($mail) = @_; my ($mail) = @_;
my $email = Email::Simple->create( my $email = Email::Simple->create(
'Content-Type' => 'text/plain; charset=utf-8',
header => [ header => [
'Content-Type' => 'text/plain;',
'Content-Transfer-Encoding' => 'quoted-printable',
'From' => $mail->{'From'}, 'From' => $mail->{'From'},
'To' => $mail->{'To'}, 'To' => $mail->{'To'},
'Cc' => $mail->{'Cc'}, 'Cc' => $mail->{'Cc'},
'Reply-To' => $mail->{'Reply-To'}, 'Reply-To' => $mail->{'Reply-To'},
'Subject' => encode_mimeword($mail->{'Subject'}, 'b', 'UTF-8') 'Subject' => encode_mimeword($mail->{'Subject'}, 'b', 'UTF-8')
], ],
body => Encode::encode( utf8 => $mail->{'Data'} ), body => encode_qp($mail->{'Data'}),
); );
Email::Sender::Simple->send($email); Email::Sender::Simple->send($email);
} }

View File

@@ -164,7 +164,8 @@ sub sendMail {
$mail->{Cc} = $params->{cc} if defined $params->{cc}; $mail->{Cc} = $params->{cc} if defined $params->{cc};
$mail->{Subject} = $params->{subject} if defined $params->{subject}; $mail->{Subject} = $params->{subject} if defined $params->{subject};
$mail->{Data} = $params->{content} if defined $params->{content}; $mail->{Data} = $params->{content} if defined $params->{content};
mail::send($mail); my $result = mail::send($mail);
print "Content-type:text/plain\n\nresult:".Dumper($result);
} }
sub getMail { sub getMail {