Adding proof of concept bounce processing postfix pipe script.
This commit is contained in:
parent
ef172e2228
commit
b6d18e88a2
3 changed files with 73 additions and 109 deletions
59
sbin/newsletter-transport.pl
Executable file
59
sbin/newsletter-transport.pl
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/data/wre/prereqs/bin/perl
|
||||
|
||||
use strict;
|
||||
|
||||
BEGIN {
|
||||
unshift @INC, qw(
|
||||
/data/custom/webgui_newsletter/lib
|
||||
/data/WebGUI/lib
|
||||
);
|
||||
}
|
||||
|
||||
use WebGUI::Mailing::Email;
|
||||
use List::MoreUtils qw{ any };
|
||||
|
||||
|
||||
my $NO_SUCH_USER = 67;
|
||||
my $webguiRoot = '/data/WebGUI';
|
||||
my $configFile = 'martintwee.oqapi.nl.conf';
|
||||
|
||||
|
||||
my ( $domain, $user ) = @ARGV;
|
||||
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 } ) {
|
||||
print $log "Ignoring $domain $user\n";
|
||||
close $log;
|
||||
exit $NO_SUCH_USER;
|
||||
}
|
||||
else {
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
my $email = WebGUI::Mailing::Email->new( $session, $session->id->fromHex( $listname ) );
|
||||
|
||||
if ($email) {
|
||||
print $log "Found email instance\n";
|
||||
$email->registerBounced;
|
||||
}
|
||||
else {
|
||||
print $log "Can't find email instance\n";
|
||||
}
|
||||
$session->close;
|
||||
}
|
||||
|
||||
local $/;
|
||||
my $content = <STDIN>;
|
||||
|
||||
print $log "listname: $listname, command: $command\n";
|
||||
#print $log "content: $content\n";
|
||||
|
||||
print $log "\n\n\n\n ================================================================================\n\n\n\n";
|
||||
|
||||
close $log;
|
||||
|
||||
exit $NO_SUCH_USER unless any { $command eq $_ } qw{ subscribe unsubscribe bounces confirm };
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue