/** * Mark outbox entry as pending + store error message why it failed * * @param Gpf_Data_Record $mail * @param string $error */ private function failedSending(Gpf_Data_Record $mail, $error) { //mark outbox entry with status pending $outbox = new Gpf_Db_MailOutbox(); $outbox->set('outboxid', $mail->get('outboxid')); $outbox->set('status', Gpf_Db_Table_MailOutbox::STATUS_PENDING); $outbox->set('error_msg', $error); $outbox->set('scheduled_at', $this->createDatabase()->getDateString(time() + self::RETRY_TIME)); $outbox->update(array('status', 'error_msg', 'scheduled_at')); }
/** * Schedule mail now to queue and return Outbox object * */ public function scheduleNow($sendNow = false, $delayMinutes = 0) { $outbox = new Gpf_Db_MailOutbox(); $valueContext = new Gpf_Plugins_ValueContext($delayMinutes); $outboxArray = array(); $outbox->set('mailid', $this->getId()); $outbox->set('mailaccountid', $this->getMailAccount()->getId()); $outboxArray[0] = $outbox; $valueContext->setArray($outboxArray); Gpf_Plugins_Engine::extensionPoint('Gpf_Db_Mail.scheduleNow', $valueContext); $outbox->insert(); if ($sendNow || !$this->isCronRunning()) { $outbox->sendNow(); } }