From 0815be945ea145dca99ae9641a06b91a96547d78 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 17 Jun 2009 16:06:00 +0200 Subject: now with proper charset handling --- Makefile.PL | 1 + lib/URLQueue/MainController.pm | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 3fdd00c..d1a1a73 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -11,6 +11,7 @@ WriteMakefile( 'URI::Find' => 0, 'URI::Title' => 0, 'Email::Send' => 0, + 'MIME::EncWords' => 1, }, EXE_FILES => [ 'script/URLQueue.pl' ], ); diff --git a/lib/URLQueue/MainController.pm b/lib/URLQueue/MainController.pm index 8892578..a40c922 100644 --- a/lib/URLQueue/MainController.pm +++ b/lib/URLQueue/MainController.pm @@ -6,6 +6,8 @@ use Path::Class; use URI::Find; use URI::Title; use Email::Send; +use Encode; +use MIME::EncWords; use POSIX 'strftime'; sub new { @@ -154,6 +156,7 @@ sub handle_uris { while (@uris) { my $uri=shift @uris; my $name=shift @titles; + $body.="$title $uri\n"; } @@ -165,21 +168,25 @@ sub send_email { my $date=strftime('%a, %d %b %Y %H:%M:%S %z',localtime(time)); + $title=MIME::EncWords::encode_mimewords( + Encode::encode('utf-8',$title), + Charset=>'utf-8', + ); + my $message=<<"EOM"; From: urlqueue\@thenautilus.net To: dakkar\@thenautilus.net Subject: $title Date: $date +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit $body EOM my $sender=Email::Send->new({mailer=>'SMTP'}); $sender->mailer_args([Host=>'luxion']); - $sender->send($message); + $sender->send(Encode::encode('utf-8',$message)); } 1; - -__END__ -Date: Sat, 2 Jun 2007 09:48:26 +0200 -- cgit v1.2.3