Compare commits
2 commits
master
...
bounce_sco
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5418008419 | ||
|
|
dbf935e98b |
5 changed files with 74 additions and 12 deletions
|
|
@ -57,13 +57,45 @@ sub session {
|
||||||
sub www_bounceReport {
|
sub www_bounceReport {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $session = $self->session;
|
my $session = $self->session;
|
||||||
|
my $db = $session->db;
|
||||||
my $i18n = WebGUI::International->new( $session, 'MailingManager' );
|
my $i18n = WebGUI::International->new( $session, 'MailingManager' );
|
||||||
my $sth = $session->db->read( 'select distinct sentTo from Mailing_email where sentTo is not null' );
|
|
||||||
|
my $windowSize = 10;
|
||||||
my $output = '<table><tr><th>'.$i18n->get('email').'</th><th>'.$i18n->get('bounce score').'</th></tr>';
|
|
||||||
while ( my ($email) = $sth->array ) {
|
my $sql = <<EOSQL;
|
||||||
my $score = $self->getBounceScore( $email );
|
select
|
||||||
$output .= "<tr><td>$email</td><td>$score</td></tr>";
|
sentTo,
|
||||||
|
count(status),
|
||||||
|
bounceReason,
|
||||||
|
errorMessage
|
||||||
|
from
|
||||||
|
Mailing_email as t1
|
||||||
|
where
|
||||||
|
status='bounced'
|
||||||
|
and
|
||||||
|
(
|
||||||
|
(select count(*) from Mailing_email as t2 where t1.sentTo=t2.sentTo) < ?
|
||||||
|
or
|
||||||
|
(select lastUpdated from Mailing_email as t2 where t1.sentTo=t2.sentTo order by lastUpdated desc limit ?,1 )
|
||||||
|
)
|
||||||
|
group by
|
||||||
|
sentTo
|
||||||
|
order by
|
||||||
|
sentTo, lastUpdated
|
||||||
|
EOSQL
|
||||||
|
|
||||||
|
my $sth = $db->read( $sql, [ $windowSize, $windowSize - 1 ] );
|
||||||
|
|
||||||
|
my $output = '<table><tr><th>'
|
||||||
|
. join( '</th><th>',
|
||||||
|
$i18n->get('email'),
|
||||||
|
$i18n->get('bounce score'),
|
||||||
|
$i18n->get('bounce reason'),
|
||||||
|
$i18n->get('bounce message')
|
||||||
|
)
|
||||||
|
. '</th></tr>';
|
||||||
|
while ( my $values = $sth->arrayRef ) {
|
||||||
|
$output .= '<tr><td>'. join( '</td><td>', @$values ) . '</td></tr>';
|
||||||
}
|
}
|
||||||
$output .= '</table>';
|
$output .= '</table>';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ our $I18N = {
|
||||||
'bounce score' => {
|
'bounce score' => {
|
||||||
message => 'Bounce score',
|
message => 'Bounce score',
|
||||||
},
|
},
|
||||||
|
|
||||||
'cannot cancel' => {
|
'cannot cancel' => {
|
||||||
message => 'Mailing \'%s\' kan niet worden afgebroken.',
|
message => 'Mailing \'%s\' kan niet worden afgebroken.',
|
||||||
},
|
},
|
||||||
|
|
@ -100,6 +100,14 @@ our $I18N = {
|
||||||
'generate mailing' => {
|
'generate mailing' => {
|
||||||
message => 'Genereer mailing',
|
message => 'Genereer mailing',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'bounce reason' => {
|
||||||
|
message => 'Laatste bounce oorzaak',
|
||||||
|
},
|
||||||
|
|
||||||
|
'bounce message' => {
|
||||||
|
message => 'Laatste bounce omschrijving',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ our $I18N = {
|
||||||
'bounce score' => {
|
'bounce score' => {
|
||||||
message => 'Bounce score',
|
message => 'Bounce score',
|
||||||
},
|
},
|
||||||
|
|
||||||
'error' => {
|
'error' => {
|
||||||
message => 'An error occurred',
|
message => 'An error occurred',
|
||||||
},
|
},
|
||||||
|
|
@ -100,6 +100,14 @@ our $I18N = {
|
||||||
'generate mailing' => {
|
'generate mailing' => {
|
||||||
message => 'Generate mailing',
|
message => 'Generate mailing',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'bounce reason' => {
|
||||||
|
message => 'Latest bounce reason',
|
||||||
|
},
|
||||||
|
|
||||||
|
'bounce message' => {
|
||||||
|
message => 'Latest bounce message',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,25 @@ renamespaceTemplates( $session );
|
||||||
addSpecialStateTable( $session );
|
addSpecialStateTable( $session );
|
||||||
addListNameColumn( $session );
|
addListNameColumn( $session );
|
||||||
addRegistrationSteps( $session );
|
addRegistrationSteps( $session );
|
||||||
|
addSentToIndex( $session );
|
||||||
|
|
||||||
finish($session);
|
finish($session);
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
sub addSentToIndex {
|
||||||
|
my $session = shift;
|
||||||
|
my $db = $session->db;
|
||||||
|
|
||||||
|
print "\tAdding index to column Mailing_email.sentTo...";
|
||||||
|
|
||||||
|
my @indexes = $db->buildArray('show indexes from Mailing_email where Column_name=?',['sentTo']);
|
||||||
|
|
||||||
|
if ( @indexes == 0 ) {
|
||||||
|
$db->write('alter table Mailing_email add index(sentTo)');
|
||||||
|
}
|
||||||
|
|
||||||
|
print "Done.\n";
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
sub addListNameColumn {
|
sub addListNameColumn {
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,9 @@ my $webguiRoot = '/data/WebGUI';
|
||||||
my $session = openSession( $webguiRoot, $configFile );
|
my $session = openSession( $webguiRoot, $configFile );
|
||||||
no warnings 'once';
|
no warnings 'once';
|
||||||
*{ WebGUI::Session::Env::getIp } = sub {
|
*{ WebGUI::Session::Env::getIp } = sub {
|
||||||
return $senderIp;
|
return $senderIp || '127.0.0.1';
|
||||||
};
|
};
|
||||||
|
|
||||||
$session->log->warn( "IP is : [$senderIp][" .$session->env->getIp ."]");
|
|
||||||
|
|
||||||
WebGUI::MailCommand::processCommand( $session, $command, $id, $sender );
|
WebGUI::MailCommand::processCommand( $session, $command, $id, $sender );
|
||||||
|
|
||||||
closeSession( $session );
|
closeSession( $session );
|
||||||
|
|
@ -65,7 +63,7 @@ sub getCredentials {
|
||||||
warn "--domain parameter is required" && exit( $WRONG_USAGE ) unless $domain;
|
warn "--domain parameter is required" && exit( $WRONG_USAGE ) unless $domain;
|
||||||
warn "--user parameter is required" && exit( $WRONG_USAGE ) unless $user;
|
warn "--user parameter is required" && exit( $WRONG_USAGE ) unless $user;
|
||||||
warn "--sender parameter is required" && exit( $WRONG_USAGE ) unless $sender;
|
warn "--sender parameter is required" && exit( $WRONG_USAGE ) unless $sender;
|
||||||
warn "--senderIp parameter is required" && exit( $WRONG_USAGE ) unless $senderIp;
|
#warn "--senderIp parameter is required" && exit( $WRONG_USAGE ) unless $senderIp;
|
||||||
|
|
||||||
my $dispatch = WebGUI::Config->new( $webguiRoot, 'mailing_dispatch.config' )
|
my $dispatch = WebGUI::Config->new( $webguiRoot, 'mailing_dispatch.config' )
|
||||||
|| warn "Cannot open $webguiRoot/etc/mailing_dispatch.config" && exit( $CONFIG_ERROR );
|
|| warn "Cannot open $webguiRoot/etc/mailing_dispatch.config" && exit( $CONFIG_ERROR );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue