--- trunk/sender.pl 2005/05/15 16:32:36 17 +++ trunk/sender.pl 2005/05/15 17:04:18 19 @@ -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, ); @@ -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; @@ -227,13 +236,17 @@ foreach my $u ($user_list->search(list_id => $m->list_id)) { - my $hdr = "To: ".$u->user_id->full_name." <". $u->user_id->email. ">\n"; - if ($sent->search( message_id => $m->message_id, user_id => $u->user_id )) { print "SKIP ",$u->user_id->email," message allready sent\n"; } else { print "\t",$u->user_id->email,"\n"; + + my $hdr = "From: " . $u->list_id->name . " <" . $u->list_id->email . ">\n" . + "To: " . $u->user_id->full_name . " <". $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, @@ -266,6 +279,10 @@ Dump more info on screen. +=item --email + +Used to specify e-mail address where needed. + =back