Adding sending of batches and bounce processing.

This commit is contained in:
Martin Kamerbeek 2010-05-19 15:42:39 +02:00
parent d62f56a635
commit f8cb8cd05a
5 changed files with 134 additions and 10 deletions

View file

@ -12,24 +12,34 @@ BEGIN {
use WebGUI::Mailing::Email;
use List::MoreUtils qw{ any };
my $NO_SUCH_USER = 67;
my %configs = (
'martintwee.oqapi.nl' => 'martintwee.oqapi.nl.conf',
);
my $webguiRoot = '/data/WebGUI';
my $configFile = 'martintwee.oqapi.nl.conf';
my ( $domain, $user ) = @ARGV;
my ( $domain, $user ) = @ARGV;
my $configFile = $configs{ $domain };
my ( $listname, $command ) = $user =~ m{^(.+)-([^-]+)$}i;
#exit $NO_SUCH_USER unless any { $command eq $_ } qw{ subscribe unsubscribe bounces confirm };
open my $log, '>>/data/test.log' || die "Cannot open log";
unless ( any { $command eq $_ } qw{ subscribe unsubscribe bounce confirm } ) {
my $validCommand = any { $command eq $_ } qw{ subscribe unsubscribe bounce confirm };
print $log "[$command][$validCommand][$configFile]\n";
unless ( $configFile && $validCommand ) {
print $log "Ignoring $domain $user\n";
close $log;
exit $NO_SUCH_USER;
system "/usr/sbin/sendmail -G -i $user\@$domain";
exit(0);
}
else {
my $session = WebGUI::Session->open($webguiRoot,$configFile);