/[notice-sender]/trunk/sender.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/sender.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 17 by dpavlin, Sun May 15 16:32:36 2005 UTC revision 18 by dpavlin, Sun May 15 17:01:19 2005 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use Class::DBI::Loader::Pg;  use Class::DBI::Loader::Pg;
5  use Getopt::Long;  use Getopt::Long;
 use Mail::CheckUser qw(check_email);  
6  use Email::Valid;  use Email::Valid;
7  use Email::Send;  use Email::Send;
8    
# Line 30  my $list_opt; Line 29  my $list_opt;
29  my $add_opt;  my $add_opt;
30  my $queue_opt;  my $queue_opt;
31  my $send_opt;  my $send_opt;
32    my $email_opt;
33    
34  my $result = GetOptions(  my $result = GetOptions(
35          "list:s" => \$list_opt,          "list:s" => \$list_opt,
# Line 38  my $result = GetOptions( Line 38  my $result = GetOptions(
38          "send:s" => \$send_opt,          "send:s" => \$send_opt,
39          "debug" => \$debug,          "debug" => \$debug,
40          "verbose" => \$verbose,          "verbose" => \$verbose,
41            "email=s" => \$email_opt,
42  );  );
43    
44    
# Line 100  argument) or read from C<STDIN>. List sh Line 101  argument) or read from C<STDIN>. List sh
101   email@example.com      Optional full name of person   email@example.com      Optional full name of person
102   dpavlin@rot13.org      Dobrica Pavlinusic   dpavlin@rot13.org      Dobrica Pavlinusic
103    
104    You may use C<--email> parametar at any time to set From: e-mail address for list.
105    B<This seems somewhat cludgy, and it will probably change in future>.
106    
107  =cut  =cut
108    
109  } elsif ($add_opt) {  } elsif ($add_opt) {
# Line 107  argument) or read from C<STDIN>. List sh Line 111  argument) or read from C<STDIN>. List sh
111          my $list = $lists->find_or_create({          my $list = $lists->find_or_create({
112                  name => $add_opt,                  name => $add_opt,
113          }) || die "can't add list $add_opt\n";          }) || die "can't add list $add_opt\n";
114            if ($email_opt && $list->email ne $email_opt) {
115                    $list->email($email_opt);
116                    $list->update;
117                    $list->dbi_commit;
118            }
119    
120          my $added = 0;          my $added = 0;
121    
# Line 233  for single list. Line 242  for single list.
242                                  print "SKIP ",$u->user_id->email," message allready sent\n";                                  print "SKIP ",$u->user_id->email," message allready sent\n";
243                          } else {                          } else {
244                                  print "\t",$u->user_id->email,"\n";                                  print "\t",$u->user_id->email,"\n";
245    
246                                    # FIXME do real sending :-)
247                                  send IO => "$hdr\n$msg";                                  send IO => "$hdr\n$msg";
248    
249                                  $sent->create({                                  $sent->create({
250                                          message_id => $m->message_id,                                          message_id => $m->message_id,
251                                          user_id => $u->user_id,                                          user_id => $u->user_id,
# Line 266  Turn on debugging output from C<Class::D Line 278  Turn on debugging output from C<Class::D
278    
279  Dump more info on screen.  Dump more info on screen.
280    
281    =item --email
282    
283    Used to specify e-mail address where needed.
284    
285  =back  =back
286    
287    

Legend:
Removed from v.17  
changed lines
  Added in v.18

  ViewVC Help
Powered by ViewVC 1.1.26