--- trunk/sender.pl 2005/05/14 13:21:35 9 +++ trunk/sender.pl 2005/05/14 20:54:40 13 @@ -3,7 +3,8 @@ use strict; use Class::DBI::Loader::Pg; use Getopt::Long; -use Data::Dumper; +use Mail::CheckUser qw(check_email); +use Email::Valid; =head1 NAME @@ -26,7 +27,8 @@ =cut -my ($list_opt,$debug) = (0,0); +my $debug = 0; +my $list_opt; my $add_opt; my $queue_opt; @@ -53,12 +55,12 @@ my $users = $loader->find_class('users'); my $user_list = $loader->find_class('user_list'); my $messages = $loader->find_class('messages'); -my $message_list = $loader->find_class('message_list'); +my $queue = $loader->find_class('queue'); =item --list[=list_name] -List all available lists and users on them. Optional value to list -(like C<--list=list_name>) will produce users just on that list. +List all available lists and users on them. Optional value is name of list +and it will produce users just on that list. =cut @@ -100,6 +102,10 @@ chomp; next if (/^#/ || /^\s*$/); my ($email, $name) = split(/\s+/,$_, 2); + if (! Email::Valid->address($email)) { + print "SKIPPING $name <$email>\n"; + next; + } print "# $name <$email>\n"; my $this_user = $users->find_or_create({ email => $email, @@ -144,7 +150,7 @@ $this_message->dbi_commit(); - $message_list->find_or_create({ + $queue->find_or_create({ message_id => $this_message->id, list_id => $this_list->id, }) || die "can't add message ",$this_message->id," to list ",$this_list->id, ": ",$this_list->name;