From 846ba6f0a5a36ec34b48d9ebe8076fc69a42ff2a Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 11 Mar 2011 19:27:24 +0100 Subject: send email to new user --- fripost-adduser | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'fripost-adduser') 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<< >> -- cgit v1.2.3