Esempio n. 1
0
 /**
  * Add the Draft message sent from the client.
  *
  * @param Horde_ActiveSync_Message_Mail $draft The draft message object.
  */
 public function setDraftMessage(Horde_ActiveSync_Message_Mail $draft)
 {
     // Save for later.
     $this->_draftMessage = $draft;
     // Create headers
     $this->_headers = new Horde_Mime_Headers();
     if ($draft->to) {
         $this->_headers->addHeader('To', $draft->to);
     }
     if ($draft->cc) {
         $this->_headers->addHeader('Cc', $draft->cc);
     }
     if ($draft->subject) {
         $this->_headers->addHeader('Subject', $draft->subject);
     }
     if ($draft->bcc) {
         $this->_headers->addHeader('Bcc', $draft->bcc);
     }
     if ($draft->importance) {
         $this->_headers->addHeader('importance', $draft->importance);
     }
     if ($from = $this->_getIdentityFromAddress()) {
         $this->_headers->removeHeader('From');
         $this->_headers->addHeader('From', $from);
     }
     if ($replyto = $this->_getReplyToAddress()) {
         $this->_headers->addHeader('Reply-To', $replyto);
     }
     $this->_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     $this->_headers->addHeaderOb(Horde_Mime_Headers_ContentId::create());
     $this->_headers->addHeader('X-IMP-Draft', 'Yes');
     // Get the text part and create a mime object for it.
     $this->_textPart = new Horde_Mime_Part();
     $this->_textPart->setContents($draft->airsyncbasebody->data);
     $this->_textPart->setType($draft->airsyncbasebody->type == Horde_ActiveSync::BODYPREF_TYPE_HTML ? 'text/html' : 'text/plain');
     // Attachments.
     $this->_handleAttachments();
 }
Esempio n. 2
0
 /**
  * Sets the Content-ID header for this part.
  *
  * @param string $cid  Use this CID (if not already set). Else, generate
  *                     a random CID.
  *
  * @return string  The Content-ID for this part.
  */
 public function setContentId($cid = null)
 {
     if (!is_null($id = $this->getContentId())) {
         return $id;
     }
     $this->_headers->addHeaderOb(is_null($cid) ? Horde_Mime_Headers_ContentId::create() : new Horde_Mime_Headers_ContentId(null, $cid));
     return $this->getContentId();
 }
Esempio n. 3
0
 public function testStaticCreateMethod()
 {
     $ob = Horde_Mime_Headers_ContentId::create();
     $this->assertStringMatchesFormat('<%s@%a>', $ob->value);
 }