From 1b8567abb2b908c867b209de72072de2e294f6f0 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 25 Jun 2008 20:02:46 +0000 Subject: [PATCH] encode all parts of sent mail properly --- lib/WebGUI/Mail/Send.pm | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/WebGUI/Mail/Send.pm b/lib/WebGUI/Mail/Send.pm index 10fcb0019..25f70beb7 100644 --- a/lib/WebGUI/Mail/Send.pm +++ b/lib/WebGUI/Mail/Send.pm @@ -19,10 +19,10 @@ use LWP::MediaTypes qw(guess_media_type); use MIME::Entity; use MIME::Parser; use Net::SMTP; -use Text::Wrap; use WebGUI::Group; use WebGUI::Macro; use WebGUI::User; +use Encode qw(encode); =head1 NAME @@ -167,14 +167,10 @@ sub addHtmlRaw { my $self = shift; my $text = shift; - # Wrap text after 78 characters - local $Text::Wrap::columns = 78; - # Do not break up words - local $Text::Wrap::huge = "overflow"; - $self->getMimeEntity->attach( Charset => "UTF-8", - Data => wrap( '', '', $text ), + Encoding => "quoted-printable", + Data => encode('utf8', $text ), Type => "text/html", ); @@ -197,15 +193,12 @@ A string of text. sub addText { my $self = shift; my $text = shift; - - # Wrap text after 78 characters - local $Text::Wrap::columns = 78; - # Do not break up words - local $Text::Wrap::huge = "overflow"; $self->getMimeEntity->attach( Charset => "UTF-8", - Data => wrap( '', '', $text ), + Encoding => "quoted-printable", + Data => encode('utf8', $text ), + Type => 'text/plain', ); return undef; @@ -315,7 +308,7 @@ sub create { Bcc=>$headers->{bcc}, "Reply-To"=>$replyTo, "In-Reply-To"=>$headers->{inReplyTo}, - Subject=>$headers->{subject}, + Subject=> encode('MIME-Q', $headers->{subject}), "Message-Id"=>$id, Date=>$session->datetime->epochToMail, "X-Mailer"=>"WebGUI"