diff options
-rw-r--r-- | INSTALL | 2 | ||||
-rwxr-xr-x | fripost-adduser | 15 |
2 files changed, 13 insertions, 4 deletions
@@ -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 |