Added getMailFromQueue so we can loop over mail that got queued
This commit is contained in:
parent
e99c78cb58
commit
b26e0bae9f
1 changed files with 26 additions and 0 deletions
|
|
@ -514,6 +514,32 @@ sub getMail {
|
||||||
return from_json( $json );
|
return from_json( $json );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 getMailFromQueue ( )
|
||||||
|
|
||||||
|
Send the first mail in the queue and then retrieve it from the smtpd. Returns
|
||||||
|
false if there is no mail in the queue.
|
||||||
|
|
||||||
|
Will prepare the server if necessary
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub getMailFromQueue {
|
||||||
|
my $class = shift;
|
||||||
|
if ( !$smtpdSelect ) {
|
||||||
|
$class->prepareMailServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $messageId = $SESSION->db->quickScalar( "SELECT messageId FROM mailQueue" );
|
||||||
|
warn $messageId;
|
||||||
|
return unless $messageId;
|
||||||
|
|
||||||
|
my $mail = WebGUI::Mail::Send->retrieve( $SESSION, $messageId );
|
||||||
|
$mail->send;
|
||||||
|
|
||||||
|
return $class->getMail;
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue