From b26e0bae9fec0c8b93bdb3f02bc87afe1c4709b6 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Fri, 5 Jun 2009 02:27:59 +0000 Subject: [PATCH] Added getMailFromQueue so we can loop over mail that got queued --- t/lib/WebGUI/Test.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index 188bf5c9c..acdf3909a 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -514,6 +514,32 @@ sub getMail { 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; +} #----------------------------------------------------------------------------