本文整理汇总了PHP中Horde_Mime_Part::addMimeHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Part::addMimeHeaders方法的具体用法?PHP Horde_Mime_Part::addMimeHeaders怎么用?PHP Horde_Mime_Part::addMimeHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Mime_Part
的用法示例。
在下文中一共展示了Horde_Mime_Part::addMimeHeaders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getHeader
/**
* Returns base header information.
*
* @param integer $type See getHeader().
* @param boolean $seen Mark message as seen?
*
* @return mixed See getHeader().
*/
protected function _getHeader($type, $seen)
{
if (!isset($this->_header)) {
if (!$this->_indices) {
$this->_header = $this->_message->addMimeHeaders();
} else {
$query = new Horde_Imap_Client_Fetch_Query();
$query->headerText(array('peek' => !$seen));
$this->_header = ($res = $this->_fetchData($query)) ? $res : new Horde_Imap_Client_Data_Fetch();
}
}
switch ($type) {
case self::HEADER_OB:
return $this->_indices ? $this->_header->getHeaderText(0, Horde_Imap_Client_Data_Fetch::HEADER_PARSE) : $this->_header;
case self::HEADER_TEXT:
return $this->_indices ? $this->_header->getHeaderText() : $this->_header->toString();
case self::HEADER_STREAM:
if ($this->_indices) {
return $this->_header->getHeaderText(0, Horde_Imap_Client_Data_Fetch::HEADER_STREAM);
}
$stream = new Horde_Support_StringStream($this->_header->toString());
$stream->fopen();
return $stream;
}
}
示例2: testBug13709
public function testBug13709()
{
$p_part = new Horde_Mime_Part();
$p_part->setType('text/plain');
$p_part->setContents('Foo bär');
$h_part = new Horde_Mime_Part();
$h_part->setType('text/html');
$h_part->setContents('Foo<br />
<br />
"smith, Jane (IAM)" <<a href="mailto:Jane.smith@kit.edu">Jane.smith@kit.edu</a>> wrote:<br />
<br />
<blockquote type="cite" style="border-left:2px solid blue;margin-left:2px;padding-left:12px;"><html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hallo Jörk,<div><br></div><div>hoffe es geht dir gut und bei HHHH ist alles okay?</div><div><br></div><div>Ich wollte gerade auf die XXX III Homepage schauen und haben im Browser nur <a href="http://example.com">example.com</a> eingegeben.</div><div>Damit bin ich auf einer Seite mit XXX II - Logo gelandet, die sofort Passwort und Nutzername abgefragt hat.</div><div>Ist diese Seite auch von Euch?</div><div><br></div><div>Liebe Grüße,</div><div>Jane</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div>
<div><div style="orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 10px;">--------------------------------------------------<br>Dr. Jane smith</div><div style="orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 10px;">( geb. Repper)<br>Karlsruhe Institute of Technology (KIT) <br>IAM-WK@INT <br>Hermann-von-Helmholtz-Platz 1, Building 640, </div><div style="orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 10px;">76344 Eggenstein-Leopoldshafen, Germany<br><br>Phone CN: +49 721 608-26960</div><div style="orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 10px;">Phone CS: +49 721 608-47447<br>Web: <a href="http://www.kit.edu/">http://www.kit.edu/</a> <br><br>KIT – University of the State of Baden-Wuerttemberg and<br>National Research Center of the Helmholtz Association</div></div>
</div>
<br></div></body></html></blockquote><br /><br />');
$base_part = new Horde_Mime_Part();
$base_part->setType('multipart/alternative');
$base_part[] = $p_part;
$base_part[] = $h_part;
$headers = $base_part->addMimeHeaders();
$headers->addHeader('From', 'sender@example.com');
$headers->addHeader('Subject', 'My Subject');
$mailer = new Horde_Mail_Transport_Mock();
$base_part->send('recipient@example.com', $headers, $mailer, array('encode' => Horde_Mime_Part::ENCODE_8BIT));
$sent = current($mailer->sentMessages);
$sent_mime = Horde_Mime_Part::parseMessage($sent['header_text'] . "\n\n" . $sent['body']);
$headers = Horde_Mime_Headers::parseHeaders($sent_mime[$sent_mime->findBody('plain')]->toString(array('headers' => true, 'encode' => Horde_Mime_Part::ENCODE_8BIT)));
$this->assertEquals('8bit', $headers->getHeader('Content-Transfer-Encoding')->value_single);
$headers = Horde_Mime_Headers::parseHeaders($sent_mime[$sent_mime->findBody('html')]->toString(array('headers' => true, 'encode' => Horde_Mime_Part::ENCODE_8BIT)));
$this->assertEquals('quoted-printable', $headers->getHeader('Content-Transfer-Encoding'));
}
示例3: append
/**
* Append the current Draft message to the IMAP server.
*
* @return array An array with the following keys:
* - uid: (integer) The new draft message's IMAP UID.
* - atchash: (array) An attachment hash of newly added attachments.
*/
public function append($folderid)
{
// Init
$atc_map = array();
$atc_hash = array();
// Create the wrapper part.
$base = new Horde_Mime_Part();
$base->setType('multipart/mixed');
// Check to see if we have any existing parts to add.
if (!empty($this->_imapMessage)) {
foreach ($this->_imapMessage->getStructure() as $part) {
if ($part->isAttachment() && !in_array($part->getMimeId(), $this->_atcDelete)) {
$base->addPart($this->_imapMessage->getMimePart($part->getMimeId()));
}
}
}
// Add body
$base->addPart($this->_textPart);
// Add Mime headers
$base->addMimeHeaders(array('headers' => $this->_headers));
foreach ($this->_atcAdd as $atc) {
$base->addPart($atc);
$atc_map[$atc->displayname] = $atc->clientid;
}
$stream = $base->toString(array('stream' => true, 'headers' => $this->_headers->toString()));
$new_uid = $this->_imap->appendMessage($folderid, $stream, array('\\draft', '\\seen'));
foreach ($base as $part) {
if ($part->isAttachment() && !empty($atc_map[$part->getName()])) {
$atc_hash['add'][$atc_map[$part->getName()]] = $folderid . ':' . $stat['id'] . ':' . $part->getMimeId();
}
}
// If we pulled down an existing Draft, delete it now since the
// new one will replace it.
if (!empty($this->_imapMessage)) {
$this->_imap->deleteMessages(array($this->_draftUid), $folderid);
}
return array('uid' => $new_uid, 'atchash' => $atc_hash);
}