Skip to content

Commit cd65d63

Browse files
committed
#6 - return mail queue and queue content
1 parent 09885e1 commit cd65d63

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/TgEmail/EmailQueue.php

+7
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ protected function getMailer() {
8686
return $this->mailer;
8787
}
8888

89+
/**
90+
* Returns the mail queue object (DAO).
91+
*/
92+
public function getQueue() {
93+
return $this->mailDAO;
94+
}
95+
8996
/**
9097
* Synchronously send emails from queue according to priority.
9198
*/

src/TgEmail/EmailsDAO.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ public function housekeeping($maxSentDays = 90, $maxFailedDays = 180) {
5252
}
5353

5454
public function getPendingEmails() {
55-
return $this->find(array('status' => Email::PENDING), array('queued_time'));
55+
return $this->getEmailsByStatus(Email::PENDING, 'queued_time');
5656
}
57+
58+
public function getFailedEmails() {
59+
return $this->getEmailsByStatus(Email::FAILED);
60+
}
61+
62+
public function getEmailsByStatus($status, $order = NULL) {
63+
return $this->find(array('status' => $status), $order);
64+
}
5765
}
5866

0 commit comments

Comments
 (0)