summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2009-06-17 16:06:00 +0200
committerdakkar <dakkar@thenautilus.net>2009-06-17 16:06:00 +0200
commit0815be945ea145dca99ae9641a06b91a96547d78 (patch)
treea1651a348e536667b628276482441f3bc5548c0e
parentoh, finalmente le icone funzionano (che palle) (diff)
downloadURLQueue-0815be945ea145dca99ae9641a06b91a96547d78.tar.gz
URLQueue-0815be945ea145dca99ae9641a06b91a96547d78.tar.bz2
URLQueue-0815be945ea145dca99ae9641a06b91a96547d78.zip
now with proper charset handling
-rw-r--r--Makefile.PL1
-rw-r--r--lib/URLQueue/MainController.pm15
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