/** * send one message through smtp * * @param Felamimail_Model_Message $_message * @return Felamimail_Model_Message * @throws Tinebase_Exception_SystemGeneric */ public function sendMessage(Felamimail_Model_Message $_message) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Sending message with subject ' . $_message->subject . ' to ' . print_r($_message->to, TRUE)); } if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_message->toArray(), TRUE)); } // increase execution time (sending message with attachments can take a long time) $oldMaxExcecutionTime = Tinebase_Core::setExecutionLifeTime(300); // 5 minutes $account = Felamimail_Controller_Account::getInstance()->get($_message->account_id); try { $this->_resolveOriginalMessage($_message); $mail = $this->createMailForSending($_message, $account, $nonPrivateRecipients); $this->_sendMailViaTransport($mail, $account, $_message, true, $nonPrivateRecipients); } catch (Exception $e) { Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not send message: ' . $e); $translation = Tinebase_Translation::getTranslation('Felamimail'); $message = sprintf($translation->_('Error: %s'), $e->getMessage()); $tesg = new Tinebase_Exception_SystemGeneric($message); $tesg->setTitle($translation->_('Could not send message')); throw $tesg; } // reset max execution time to old value Tinebase_Core::setExecutionLifeTime($oldMaxExcecutionTime); return $_message; }
/** * the constructor * _('This is a system container which could not be deleted!') * * @param string $_message * @param int $_code */ public function __construct($_message = 'This is a system container which could not be deleted!', $_code = 600) { parent::__construct($_message, $_code); }