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 |
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'}, |
45 |
"from=s" => \$opt->{'from'}, |
"from=s" => \$opt->{'from'}, |
46 |
"driver=s" => \$opt->{'email_send_driver'}, |
"driver=s" => \$opt->{'email_send_driver'}, |
47 |
"sleep=i" => \$opt->{'sleep'}, |
"sleep=i" => \$opt->{'sleep'}, |
48 |
|
"aliases=s" => \$opt->{'aliases'}, |
49 |
); |
); |
50 |
|
|
51 |
my $nos = new Nos( |
my $nos = new Nos( |
82 |
You can also add C<--from='Full name of list'> to specify full name (comment) |
You can also add C<--from='Full name of list'> to specify full name (comment) |
83 |
in outgoing e-mail. |
in outgoing e-mail. |
84 |
|
|
85 |
|
Optional parametar C<--aliases='/full/path/to/aliases'> can be used to |
86 |
|
specify aliases file other than C</etc/aliases>. |
87 |
|
|
88 |
=cut |
=cut |
89 |
|
|
90 |
if ($list_name = $opt->{'new'}) { |
if ($list_name = $opt->{'new'}) { |
94 |
|
|
95 |
die "need e-mail address for list (as argument or on STDIN)\n" unless ($email); |
die "need e-mail address for list (as argument or on STDIN)\n" unless ($email); |
96 |
|
|
97 |
|
my $aliases = $opt->{'aliases'} || '/etc/aliases'; |
98 |
|
|
99 |
my $id = $nos->new_list( |
my $id = $nos->new_list( |
100 |
list => $list_name, |
list => $list_name, |
101 |
from => ($opt->{'from'} || ''), |
from => ($opt->{'from'} || ''), |
102 |
email => $email, |
email => $email, |
103 |
|
aliases => $aliases, |
104 |
) || die "can't add list $list_name\n"; |
) || die "can't add list $list_name\n"; |
105 |
|
|
106 |
print "added list $list_name with ID $id\n"; |
print "added list $list_name with ID $id\n"; |
128 |
foreach my $list (@lists) { |
foreach my $list (@lists) { |
129 |
print $list->name,": ",$list->from_addr," <",$list->email,">\n"; |
print $list->name,": ",$list->from_addr," <",$list->email,">\n"; |
130 |
foreach my $u ($nos->list_members( list => $list->name )) { |
foreach my $u ($nos->list_members( list => $list->name )) { |
131 |
print "\t",$u->{'name'}, " <", $u->{'email'}, ">\n"; |
print "\t",$u->{'name'}, " <", $u->{'email'}, ">",( $u->{'ext_id'} ? ' ['.$u->{'ext_id'}.']' : '' ),"\n"; |
132 |
} |
} |
133 |
} |
} |
134 |
|
|
159 |
print "list ",$list->name," has $added users\n"; |
print "list ",$list->name," has $added users\n"; |
160 |
|
|
161 |
|
|
162 |
|
=item --delete=list_name |
163 |
|
|
164 |
|
Delete users from list. User e-mails can be stored in file (which can be |
165 |
|
supplied as argument) or read from C<STDIN>. |
166 |
|
|
167 |
|
=cut |
168 |
|
} elsif ($list_name = $opt->{'delete'}) { |
169 |
|
|
170 |
|
my $list = $nos->_get_list($list_name) || die "can't find list $list_name\n"; |
171 |
|
|
172 |
|
my $deleted = 0; |
173 |
|
|
174 |
|
while(<>) { |
175 |
|
chomp; |
176 |
|
next if (/^#/ || /^\s*$/); |
177 |
|
my $email = $_; |
178 |
|
$deleted++ if ($nos->delete_member_from_list( email => $email, list => $list_name )); |
179 |
|
} |
180 |
|
|
181 |
|
print "list ",$list->name," lost $deleted users\n"; |
182 |
|
|
183 |
|
|
184 |
=item --queue[=list_name] |
=item --queue[=list_name] |
185 |
|
|
186 |
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 |