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 --- fripost-adduser | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'fripost-adduser') 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