Adding sending of batches and bounce processing.
This commit is contained in:
parent
d62f56a635
commit
f8cb8cd05a
5 changed files with 134 additions and 10 deletions
|
|
@ -123,6 +123,7 @@ sub www_view {
|
|||
%{ $mailing->get },
|
||||
status => $mailing->getStatusLine,
|
||||
sendTestUrl => $url->page('newsletter=mailing;func=sendTestEmails;id='.$mailing->getId),
|
||||
sendUrl => $url->page('newsletter=mailing;func=sendBatch;id='.$mailing->getId),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,37 @@ sub getQueuedTestEmails {
|
|||
return $it;
|
||||
}
|
||||
|
||||
sub getSendableEmails {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
||||
my $it = $class->getAllIterator( $session, {
|
||||
joinUsing => [
|
||||
{ 'WGMailing' => 'mailingId' },
|
||||
],
|
||||
constraints => [
|
||||
{ 'isTest=?' => [ 0 ] },
|
||||
{ 'status=?' => [ 'queued' ] },
|
||||
{ 'active=?' => [ 1 ] },
|
||||
{ 'sendDate <= ?' => [ time ] },
|
||||
],
|
||||
} );
|
||||
|
||||
my @sql = $class->getAllSql( $session, {
|
||||
joinUsing => [
|
||||
{ 'WGMailing' => 'mailingId' },
|
||||
],
|
||||
constraints => [
|
||||
{ 'isTest=?' => [ 0 ] },
|
||||
{ 'status=?' => [ 'queued' ] },
|
||||
{ 'active=?' => [ 1 ] },
|
||||
{ 'sendDate <= ?' => [ time ] },
|
||||
],
|
||||
} );
|
||||
$session->log->warn( "--->" . shift( @sql ) . join "\n\n", @{ shift @sql } );
|
||||
return $it;
|
||||
}
|
||||
|
||||
sub error {
|
||||
my $self = shift;
|
||||
my $message = shift;
|
||||
|
|
@ -145,7 +176,7 @@ sub send {
|
|||
|
||||
# Setup email
|
||||
my $mail = WebGUI::Mail::Send->create( $session, {
|
||||
#from => TODO
|
||||
from => 'martin@geefmegeld.nl',
|
||||
to => $to,
|
||||
subject => $subject,
|
||||
messageId => "$messageId\@$domain",
|
||||
|
|
@ -156,7 +187,7 @@ sub send {
|
|||
# And send it.
|
||||
my $success = $mail->send;
|
||||
|
||||
|
||||
$session->log->warn( "Sending email to [$to]" );
|
||||
if ( $success ne '1' ) {
|
||||
$self->error( "Mail couldn't be sent by WebGUI::Mail::Send" );
|
||||
}
|
||||
|
|
@ -167,6 +198,14 @@ sub send {
|
|||
return;
|
||||
}
|
||||
|
||||
sub user {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my $user = WebGUI::User->new( $session, $self->get('userId') );
|
||||
return $user;
|
||||
}
|
||||
|
||||
sub registerBounced {
|
||||
my $self = shift;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue