Fieldmap: reimplement d3 rebind
[sgn.git] / bin / send_passwords.pl
blob69313e4d85fa3b172bc36086890b36c0ba00fdd2
1 #!/usr/bin/perl
3 use strict;
4 use Mail::Sendmail;
6 my $file = shift;
7 my $host = shift;
9 if (!$host) { die "Need file and host as arguments\n"; }
11 open(my $F, "< :encoding(UTF8)", $file) || die "Can't open file $file";
13 while (<$F>) {
14 chomp;
15 my ($first_name, $last_name, $username, $email, $password) = split /\t/;
17 my $message_text = "Dear $first_name $last_name\n\nYour account on $host has been created. The username is $username and the password is $password\n\nBest regards,\n\nBreedbase";
19 print STDERR "Sending message: $message_text... ";
21 my %mail = ( To => $email,
22 From => 'production@breedbase.org',
23 Subject => "Your Breedbase Account",
24 Message => $message_text
27 sendmail(%mail) or die $Mail::Sendmail::error;
28 print STDERR "Done!\n";