--- trunk/sender.pl 2005/05/15 16:25:01 15 +++ trunk/sender.pl 2005/05/15 17:01:19 18 @@ -3,7 +3,6 @@ use strict; use Class::DBI::Loader::Pg; use Getopt::Long; -use Mail::CheckUser qw(check_email); use Email::Valid; use Email::Send; @@ -30,6 +29,7 @@ my $add_opt; my $queue_opt; my $send_opt; +my $email_opt; my $result = GetOptions( "list:s" => \$list_opt, @@ -38,6 +38,7 @@ "send:s" => \$send_opt, "debug" => \$debug, "verbose" => \$verbose, + "email=s" => \$email_opt, ); @@ -85,7 +86,7 @@ } foreach my $list (@lists) { - print $list->name,"\n"; + print $list->name," <",$list->email,">\n"; foreach my $user_on_list ($user_list->search(list_id => $list->id)) { my $user = $users->retrieve( id => $user_on_list->user_id ); print "\t",$user->full_name," <", $user->email, ">\n"; @@ -100,6 +101,9 @@ email@example.com Optional full name of person dpavlin@rot13.org Dobrica Pavlinusic +You may use C<--email> parametar at any time to set From: e-mail address for list. +B. + =cut } elsif ($add_opt) { @@ -107,6 +111,11 @@ my $list = $lists->find_or_create({ name => $add_opt, }) || die "can't add list $add_opt\n"; + if ($email_opt && $list->email ne $email_opt) { + $list->email($email_opt); + $list->update; + $list->dbi_commit; + } my $added = 0; @@ -143,7 +152,8 @@ Queue message for later delivery. Message can be read from file (specified as argument) or read from C. -This options without optional parametars it will display current queue. +This option without optional parametar will display pending queue. If you +add C<--verbose> flag, it will display all messages in queue. =cut @@ -201,8 +211,8 @@ =item --send[=list_name] -Send e-mail waiting in queue for all lists, or with optional argument for -just single list. +Send e-mails waiting in queue, or with optional argument, just send messages +for single list. =cut @@ -232,7 +242,10 @@ print "SKIP ",$u->user_id->email," message allready sent\n"; } else { print "\t",$u->user_id->email,"\n"; + + # FIXME do real sending :-) send IO => "$hdr\n$msg"; + $sent->create({ message_id => $m->message_id, user_id => $u->user_id, @@ -265,6 +278,10 @@ Dump more info on screen. +=item --email + +Used to specify e-mail address where needed. + =back