From 53bb0cb56f580b7115b874fe40d9011efe6dd8ed Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 14 Mar 2011 14:57:50 +0100 Subject: Fix encoding of welcome message --- INSTALL | 2 +- fripost-adduser | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/INSTALL b/INSTALL index 95a169a..74be19a 100644 --- a/INSTALL +++ b/INSTALL @@ -4,4 +4,4 @@ If you use Debian GNU/Linux, you can install them like so: aptitude install -R libdatetime-format-mysql-perl libdatetime-perl \ libdbix-class-perl libemail-valid-perl libfile-slurp-perl libio-prompt-perl \ -libmime-lite-perl libstring-mkpasswd-perl libyaml-syck-perl +libmime-base64-perl libmime-lite-perl libstring-mkpasswd-perl libyaml-syck-perl diff --git a/fripost-adduser b/fripost-adduser index 73ff70b..192a691 100755 --- a/fripost-adduser +++ b/fripost-adduser @@ -16,13 +16,16 @@ use FindBin qw($Bin); use lib "$Bin/lib"; use Data::Dumper; +use Encode qw(encode); use File::Slurp qw(slurp); use Fripost::Password; use Fripost::Prompt; use Fripost::Schema; -use IO::Prompt; use Getopt::Long; +use IO::Prompt; +use MIME::Base64; use MIME::Lite; +use MIME::QuotedPrint; use YAML::Syck; # Prompt for user info @@ -86,14 +89,20 @@ say "New account $user->{username} added."; ## Send email my $msg = MIME::Lite->new( From => 'admin@fripost.org', - To => $user->{username}, - Subject => 'Välkommen till Fripost!', + To => 'test@example.com', + Subject => "=?UTF-8?B?" . + encode_base64(encode("utf8", 'Välkommen till Fripost!'), "") . "?=", Data => scalar slurp('templ/new_user_mail.tt'), # TODO: actually use TT + Encoding => 'quoted-printable', ); + +$msg->attr('content-type.charset' => 'utf-8'); $msg->send(); say "Sent welcome message: "; say $msg->as_string; +#say decode_qp($msg->as_string); + =head1 AUTHOR -- cgit v1.2.3