--- trunk/sender.pl 2005/05/18 13:12:54 45 +++ trunk/sender.pl 2005/06/08 14:26:31 55 @@ -19,7 +19,7 @@ In C something like: - mylist: "| /path/to/sender.pl --inbox=mylist" + mylist: "| cd /path/to && ./sender.pl --inbox=mylist" =head2 Command options @@ -40,6 +40,9 @@ "inbox=s" => \$opt->{'inbox'}, "debug" => \$debug, "verbose" => \$verbose, + "from=s" => \$opt->{'from'}, + "driver=s" => \$opt->{'email_send_driver'}, + "sleep=i" => \$opt->{'sleep'}, ); my $nos = new Nos( @@ -73,6 +76,9 @@ Adds new list. You can also feed list name as first line to C. +You can also add C<--from='Full name of list'> to specify full name (comment) +in outgoing e-mail. + =cut if ($list_name = $opt->{'new'}) { @@ -84,6 +90,7 @@ my $id = $nos->new_list( list => $list_name, + from => ($opt->{'from'} || ''), email => $email, ) || die "can't add list $list_name\n"; @@ -110,7 +117,7 @@ } foreach my $list (@lists) { - print $list->name," <",$list->email,">\n"; + print $list->name,": ",$list->from_addr," <",$list->email,">\n"; foreach my $u ($nos->list_members( list => $list->name )) { print "\t",$u->{'name'}, " <", $u->{'email'}, ">\n"; } @@ -129,9 +136,7 @@ } elsif ($list_name = $opt->{'add'}) { - my $list = $lists->find_or_create({ - name => $list_name, - }) || die "can't add list $list_name\n"; + my $list = $nos->_get_list($list_name) || die "can't find list $list_name\n"; my $added = 0; @@ -199,11 +204,29 @@ Send e-mails waiting in queue, or with optional argument, just send messages for single list. +Optional argument C<--driver=smtp> forces sending using SMTP server at +localhost (127.0.0.1). + +Optional argument C<--sleep=42> defines that sender will sleep 42 seconds +between sending e-mail. + =cut } elsif (defined($list_name = $opt->{'send'})) { - $nos->send_queued_messages($list_name); + unless ($opt->{'email_send_driver'}) { + print "WARNING: this will dump debugging output to STDERR\n"; + print "enter alternative driver (e.g. smtp): "; + my $d = ; + chomp($d); + $opt->{'email_send_driver'} = $d; + } + + $nos->send_queued_messages( + list => $list_name, + driver => $opt->{'email_send_driver'}, + sleep => $opt->{'sleep'}, + ); =item --inbox=list_name