40 |
"inbox=s" => \$opt->{'inbox'}, |
"inbox=s" => \$opt->{'inbox'}, |
41 |
"debug" => \$debug, |
"debug" => \$debug, |
42 |
"verbose" => \$verbose, |
"verbose" => \$verbose, |
43 |
"email=s" => \$opt->{'email'}, |
"from=s" => \$opt->{'from'}, |
44 |
|
"driver=s" => \$opt->{'email_send_driver'}, |
45 |
); |
); |
46 |
|
|
47 |
my $nos = new Nos( |
my $nos = new Nos( |
75 |
|
|
76 |
Adds new list. You can also feed list name as first line to C<STDIN>. |
Adds new list. You can also feed list name as first line to C<STDIN>. |
77 |
|
|
78 |
|
You can also add C<--from='Full name of list'> to specify full name (comment) |
79 |
|
in outgoing e-mail. |
80 |
|
|
81 |
=cut |
=cut |
82 |
|
|
83 |
if ($list_name = $opt->{'new'}) { |
if ($list_name = $opt->{'new'}) { |
87 |
|
|
88 |
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); |
89 |
|
|
90 |
my $l = $nos->_get_list($list_name) || $nos->_add_list( |
my $id = $nos->new_list( |
91 |
list => $list_name, |
list => $list_name, |
92 |
|
from => ($opt->{'from'} || ''), |
93 |
email => $email, |
email => $email, |
94 |
) || die "can't add list $list_name\n"; |
) || die "can't add list $list_name\n"; |
95 |
|
|
96 |
print "added list $list_name with ID ",$l->id,"\n"; |
print "added list $list_name with ID $id\n"; |
97 |
|
|
98 |
|
|
99 |
=item --list[=list_name] |
=item --list[=list_name] |
117 |
|
|
118 |
foreach my $list (@lists) { |
foreach my $list (@lists) { |
119 |
print $list->name," <",$list->email,">\n"; |
print $list->name," <",$list->email,">\n"; |
120 |
foreach my $user_on_list ($user_list->search(list_id => $list->id)) { |
foreach my $u ($nos->list_members( list => $list->name )) { |
121 |
my $user = $users->retrieve( id => $user_on_list->user_id ); |
print "\t",$u->{'name'}, " <", $u->{'email'}, ">\n"; |
|
print "\t",$user->full_name," <", $user->email, ">\n"; |
|
122 |
} |
} |
123 |
} |
} |
124 |
|
|
131 |
email@example.com Optional full name of person |
email@example.com Optional full name of person |
132 |
dpavlin@rot13.org Dobrica Pavlinusic |
dpavlin@rot13.org Dobrica Pavlinusic |
133 |
|
|
|
You may use C<--email> parametar at any time to set From: e-mail address for list. |
|
|
B<This seems somewhat cludgy, and it will probably change in future>. |
|
|
|
|
134 |
=cut |
=cut |
135 |
|
|
136 |
} elsif ($list_name = $opt->{'add'}) { |
} elsif ($list_name = $opt->{'add'}) { |
191 |
my $msg = $m->message_id->message; |
my $msg = $m->message_id->message; |
192 |
$msg =~ s/\s+/ /gs; |
$msg =~ s/\s+/ /gs; |
193 |
|
|
194 |
$l .= sprintf(" %-10s %15s : ", $m->list_id->name, $date); |
$l .= sprintf(" %-15s %15s : ", $m->list_id->name, $date); |
195 |
$l .= substr($msg, 0, 79 - length($l)); |
$l .= substr($msg, 0, 79 - length($l)); |
196 |
|
|
197 |
print "$l\n"; |
print "$l\n"; |
205 |
Send e-mails waiting in queue, or with optional argument, just send messages |
Send e-mails waiting in queue, or with optional argument, just send messages |
206 |
for single list. |
for single list. |
207 |
|
|
208 |
|
Optional argument C<--driver=smtp> forces sending using SMTP server at |
209 |
|
localhost (127.0.0.1). |
210 |
|
|
211 |
=cut |
=cut |
212 |
|
|
213 |
} elsif (defined($list_name = $opt->{'send'})) { |
} elsif (defined($list_name = $opt->{'send'})) { |
214 |
|
|
215 |
$nos->send_queued_messages($list_name); |
$nos->send_queued_messages($list_name, $opt->{'email_send_driver'}); |
216 |
|
|
217 |
|
|
218 |
=item --inbox=list_name |
=item --inbox=list_name |
221 |
|
|
222 |
=cut |
=cut |
223 |
|
|
224 |
} elsif ($opt->{'inbox'}) { |
} elsif ($list_name = $opt->{'inbox'}) { |
225 |
|
|
226 |
|
my $message; |
227 |
|
while(<>) { |
228 |
|
$message .= $_; |
229 |
|
} |
230 |
|
|
231 |
|
$nos->inbox_message( |
232 |
|
list => $list_name, |
233 |
|
message => $message, |
234 |
|
) || die "can't receive message for list $list_name"; |
235 |
|
|
|
warn "inbox option is not implemented"; |
|
236 |
|
|
237 |
} else { |
} else { |
238 |
die "see perldoc $0 for help\n"; |
die "see perldoc $0 for help\n"; |
254 |
|
|
255 |
Dump more info on screen. |
Dump more info on screen. |
256 |
|
|
|
=item --email |
|
|
|
|
|
Used to specify e-mail address where needed. |
|
|
|
|
257 |
=back |
=back |
258 |
|
|
259 |
|
|