diff --git a/install/INSTALL.md b/install/INSTALL.md index 2b3ca7f..f9a5be2 100644 --- a/install/INSTALL.md +++ b/install/INSTALL.md @@ -96,6 +96,7 @@ apt-get install libmime-tools-perl libsession-token-perl libtext-multimarkdown-perl + libtext-unidecode libtext-wikicreole-perl liburi-escape-xs-perl perlmagick diff --git a/lib/calcms/mail.pm b/lib/calcms/mail.pm index 0ae856d..fb09583 100644 --- a/lib/calcms/mail.pm +++ b/lib/calcms/mail.pm @@ -3,11 +3,27 @@ package mail; use strict; use warnings; no warnings 'redefine'; +use utf8; use Email::Sender::Simple(); use Email::Simple(); -use MIME::Words qw(encode_mimeword); -use MIME::QuotedPrint qw(encode_qp); +use Text::Unidecode qw(unidecode); + +sub to_ascii { + my ($s) = @_; + my %translate = qw( + Ä Ae + ä ae + Ö Oe + ö oe + Ü Ue + ü ue + ß ss + ); + $s =~ s/([ÄäÖöÜüß])/$translate{$1}/g; + $s = unidecode $s; + return $s; +} sub send($) { my ($mail) = @_; @@ -15,14 +31,13 @@ sub send($) { my $email = Email::Simple->create( header => [ 'Content-Type' => 'text/plain;', - 'Content-Transfer-Encoding' => 'quoted-printable', 'From' => $mail->{'From'}, 'To' => $mail->{'To'}, 'Cc' => $mail->{'Cc'}, 'Reply-To' => $mail->{'Reply-To'}, - 'Subject' => encode_mimeword($mail->{'Subject'}, 'b', 'UTF-8') + 'Subject' => to_ascii($mail->{'Subject'}) ], - body => encode_qp($mail->{'Data'}), + body => to_ascii($mail->{'Data'}) ); Email::Sender::Simple->send($email); }