Пример #1
0
 /**
  * this function generates the response for the client
  * 
  * @return void
  */
 public function getResponse()
 {
     $rfc822 = Felamimail_Controller_Message::getInstance()->getMessagePart($this->_itemId);
     $rfc822->type = Felamimail_Model_Message::CONTENT_TYPE_MESSAGE_RFC822;
     $rfc822->filename = 'forwarded email.eml';
     $rfc822->encoding = Zend_Mime::ENCODING_7BIT;
     $mail = Tinebase_Mail::createFromZMM($this->_incomingMessage);
     $mail->addAttachment($rfc822);
     Felamimail_Controller_Message_Send::getInstance()->sendZendMail($this->_account, $mail, $this->_saveInSent);
 }
 /**
  * send email
  *
  * @param resource $inputStream
  * @param boolean $saveInSent
  * @throws Syncroton_Exception
  */
 public function sendEmail($inputStream, $saveInSent)
 {
     $defaultAccountId = Tinebase_Core::getPreference('Expressomail')->{Expressomail_Preference::DEFAULTACCOUNT};
     try {
         $account = Expressomail_Controller_Account::getInstance()->get($defaultAccountId);
     } catch (Tinebase_Exception_NotFound $ten) {
         if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . " no email account configured");
         }
         throw new Syncroton_Exception('no email account configured');
     }
     if (empty(Tinebase_Core::getUser()->accountEmailAddress)) {
         throw new Syncroton_Exception('no email address set for current user');
     }
     if (!is_resource($inputStream)) {
         $stream = fopen("php://temp", 'r+');
         fwrite($stream, $inputStream);
         $inputStream = $stream;
         rewind($inputStream);
     }
     if ($this->_debugEmail == true) {
         $debugStream = fopen("php://temp", 'r+');
         stream_copy_to_stream($inputStream, $debugStream);
         rewind($debugStream);
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " email to send:" . stream_get_contents($debugStream));
         }
         //replace original stream wirh debug stream, as php://input can't be rewinded
         $inputStream = $debugStream;
         rewind($inputStream);
     }
     $incomingMessage = new Zend_Mail_Message(array('file' => $inputStream));
     $subject = $incomingMessage->headerExists('subject') ? $incomingMessage->getHeader('subject') : null;
     if (Tinebase_Mail::isiMIPMail($incomingMessage)) {
         if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
             Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Do not send iMIP message with subject "' . $subject . '". The server should handle those.');
         }
     } else {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Send Message with subject " . $subject . " (saveInSent: " . $saveInSent . ")");
         }
         $mail = Tinebase_Mail::createFromZMM($incomingMessage);
         Expressomail_Controller_Message_Send::getInstance()->sendZendMail($account, $mail, (bool) $saveInSent);
     }
 }
Пример #3
0
 /**
  * this function generates the response for the client
  * 
  * @return void
  */
 public function getResponse()
 {
     $replyBody = Felamimail_Controller_Message::getInstance()->getMessageBody($this->_itemId, null, 'text/plain');
     $mail = Tinebase_Mail::createFromZMM($this->_incomingMessage, $replyBody);
     Felamimail_Controller_Message_Send::getInstance()->sendZendMail($this->_account, $mail, $this->_saveInSent);
 }
Пример #4
0
 /**
  * this function generates the response for the client
  * 
  * @return void
  */
 public function getResponse()
 {
     $mail = Tinebase_Mail::createFromZMM($this->_incomingMessage);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " saveInSent: " . (int) $this->_saveInSent);
     }
     Felamimail_Controller_Message_Send::getInstance()->sendZendMail($this->_account, $mail, $this->_saveInSent);
 }