aboutsummaryrefslogtreecommitdiffstats
path: root/fripost-adduser
diff options
context:
space:
mode:
authorStefan Kangas <skangas@skangas.se>2011-03-11 19:27:24 +0100
committerStefan Kangas <skangas@skangas.se>2011-03-11 19:27:24 +0100
commit846ba6f0a5a36ec34b48d9ebe8076fc69a42ff2a (patch)
treec2d9d1176626e8eadb6e6759981fe95b9d5b686b /fripost-adduser
parentf559605cb240edb57d1a0e0338b449e4ca767d51 (diff)
send email to new user
Diffstat (limited to 'fripost-adduser')
-rwxr-xr-xfripost-adduser14
1 files changed, 14 insertions, 0 deletions
diff --git a/fripost-adduser b/fripost-adduser
index e4a4298..0d65cf3 100755
--- a/fripost-adduser
+++ b/fripost-adduser
@@ -16,11 +16,13 @@ use FindBin qw($Bin);
use lib "$Bin/lib";
use Data::Dumper;
+use File::Slurp qw(slurp);
use Fripost::Password;
use Fripost::Prompt;
use Fripost::Schema;
use IO::Prompt;
use Getopt::Long;
+use MIME::Lite;
use YAML::Syck;
# Prompt for user info
@@ -92,6 +94,18 @@ my $db_user = $schema->resultset('Mailbox')->new($user);
$db_user->insert;
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!',
+ Data => slurp('templ/new_user_mail.tt'), # TODO: actually use TT
+);
+$msg->send();
+
+say "Sent welcome message: ";
+say $message->as_text;
+
=head1 AUTHOR
Stefan Kangas C<< <skangas at skangas.se> >>