/[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 49 by dpavlin, Tue May 24 16:44:34 2005 UTC revision 61 by dpavlin, Wed Jun 22 12:26:54 2005 UTC
# Line 13  sender.pl - command line notify sender u Line 13  sender.pl - command line notify sender u
13    
14   sender.pl --new=mylist   sender.pl --new=mylist
15   sender.pl --add=mylist members.txt   sender.pl --add=mylist members.txt
16     sender.pl --delete=mylist members.txt
17   sender.pl --list[=mylist]   sender.pl --list[=mylist]
18   sender.pl --queue[=mylist message.txt]   sender.pl --queue[=mylist message.txt]
19   sender.pl --send=mylist   sender.pl --send=mylist
# Line 35  my $result = GetOptions( Line 36  my $result = GetOptions(
36          "new=s" => \$opt->{'new'},          "new=s" => \$opt->{'new'},
37          "list:s" => \$opt->{'list'},          "list:s" => \$opt->{'list'},
38          "add=s" => \$opt->{'add'},          "add=s" => \$opt->{'add'},
39            "delete=s" => \$opt->{'delete'},
40          "queue:s" => \$opt->{'queue'},          "queue:s" => \$opt->{'queue'},
41          "send:s" => \$opt->{'send'},          "send:s" => \$opt->{'send'},
42          "inbox=s" => \$opt->{'inbox'},          "inbox=s" => \$opt->{'inbox'},
# Line 117  on that list. Line 119  on that list.
119          }          }
120    
121          foreach my $list (@lists) {          foreach my $list (@lists) {
122                  print $list->name," <",$list->email,">\n";                  print $list->name,": ",$list->from_addr," <",$list->email,">\n";
123                  foreach my $u ($nos->list_members( list => $list->name )) {                  foreach my $u ($nos->list_members( list => $list->name )) {
124                          print "\t",$u->{'name'}, " <", $u->{'email'}, ">\n";                          print "\t",$u->{'name'}, " <", $u->{'email'}, ">",( $u->{'ext_id'} ? ' ['.$u->{'ext_id'}.']' : '' ),"\n";
125                  }                  }
126          }          }
127    
# Line 136  argument) or read from C<STDIN>. List sh Line 138  argument) or read from C<STDIN>. List sh
138    
139  } elsif ($list_name = $opt->{'add'}) {  } elsif ($list_name = $opt->{'add'}) {
140    
141          my $list = $lists->find_or_create({          my $list = $nos->_get_list($list_name) || die "can't find list $list_name\n";
                 name => $list_name,  
         }) || die "can't add list $list_name\n";  
142    
143          my $added = 0;          my $added = 0;
144    
# Line 152  argument) or read from C<STDIN>. List sh Line 152  argument) or read from C<STDIN>. List sh
152          print "list ",$list->name," has $added users\n";          print "list ",$list->name," has $added users\n";
153    
154    
155    =item --delete=list_name
156    
157    Delete users from list. User e-mails can be stored in file (which can be
158    supplied as argument) or read from C<STDIN>.
159    
160    =cut
161    } elsif ($list_name = $opt->{'delete'}) {
162    
163            my $list = $nos->_get_list($list_name) || die "can't find list $list_name\n";
164    
165            my $deleted = 0;
166    
167            while(<>) {
168                    chomp;
169                    next if (/^#/ || /^\s*$/);
170                    my $email = $_;
171                    $deleted++ if ($nos->delete_member_from_list( email => $email, list => $list_name ));
172            }
173    
174            print "list ",$list->name," lost $deleted users\n";
175    
176    
177  =item --queue[=list_name]  =item --queue[=list_name]
178    
179  Queue message for later delivery. Message can be read from file (specified as  Queue message for later delivery. Message can be read from file (specified as
# Line 216  between sending e-mail. Line 238  between sending e-mail.
238    
239  } elsif (defined($list_name = $opt->{'send'})) {  } elsif (defined($list_name = $opt->{'send'})) {
240    
241            unless ($opt->{'email_send_driver'}) {
242                    print "WARNING: this will dump debugging output to STDERR\n";
243                    print "enter alternative driver (e.g. smtp): ";
244                    my $d = <STDIN>;
245                    chomp($d);
246                    $opt->{'email_send_driver'} = $d;
247            }
248    
249          $nos->send_queued_messages(          $nos->send_queued_messages(
250                  list => $list_name,                  list => $list_name,
251                  driver => $opt->{'email_send_driver'},                  driver => $opt->{'email_send_driver'},

Legend:
Removed from v.49  
changed lines
  Added in v.61

  ViewVC Help
Powered by ViewVC 1.1.26