Change mialing flow and defere queueing of emails until schedule date.

This commit is contained in:
Martin Kamerbeek 2010-06-02 11:31:10 +02:00
parent e7b9a4480a
commit ee4c7549f2
2 changed files with 112 additions and 17 deletions

View file

@ -55,11 +55,14 @@ sub execute {
$email->send;
}
# Fetch mailings that are scheduled to be sent one by one, and send them.
# Queue all mailings that are ready to send.
WebGUI::Mailing->queueScheduled( $session );
# Fetch mailings that are queued to be sent one by one, and send them.
while ( my $mailing = WebGUI::Mailing->getNextInSendQueue( $session ) ) {
return $self->WAITING(1) if time >= $maxTime;
$mailing->sendQueuedEmails( $maxTime ) || return $self->WAITING(1);
$mailing->send( $maxTime ) || return $self->WAITING(1);
}
return $self->COMPLETE;