本文整理汇总了PHP中Horde_Mime_Headers::removeHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Headers::removeHeader方法的具体用法?PHP Horde_Mime_Headers::removeHeader怎么用?PHP Horde_Mime_Headers::removeHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Mime_Headers
的用法示例。
在下文中一共展示了Horde_Mime_Headers::removeHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __set
/**
*/
public function __set($name, $value)
{
if (!strlen($value)) {
return;
}
switch ($name) {
case 'bcc':
case 'cc':
case 'date':
case 'from':
case 'in_reply_to':
case 'message_id':
case 'reply_to':
case 'sender':
case 'subject':
case 'to':
switch ($name) {
case 'from':
foreach (array('reply_to', 'sender') as $val) {
if ($this->{$val}->match($value)) {
$this->_data->removeHeader($val);
}
}
break;
case 'reply_to':
case 'sender':
if ($this->from->match($value)) {
$this->_data->removeHeader($name);
return;
}
/* Convert reply-to name. */
if ($name == 'reply_to') {
$name = 'reply-to';
}
break;
}
$this->_data->addHeader($name, $value, array('sanity_check' => true));
break;
}
}
示例2: send
/**
* Sends this message.
*
* @param Mail $mailer A Mail object.
* @param boolean $resend If true, the message id and date are re-used;
* If false, they will be updated.
* @param boolean $flowed Send message in flowed text format.
*
* @throws Horde_Mime_Exception
*/
public function send($mailer, $resend = false, $flowed = true)
{
/* Add mandatory headers if missing. */
$has_header = $this->_headers->getValue('Message-ID');
if (!$resend || !$has_header) {
if ($has_header) {
$this->_headers->removeHeader('Message-ID');
}
$this->_headers->addMessageIdHeader();
}
if (!$this->_headers->getValue('User-Agent')) {
$this->_headers->addUserAgentHeader();
}
$has_header = $this->_headers->getValue('Date');
if (!$resend || !$has_header) {
if ($has_header) {
$this->_headers->removeHeader('Date');
}
$this->_headers->addHeader('Date', date('r'));
}
if (isset($this->_base)) {
$basepart = $this->_base;
} else {
/* Send in flowed format. */
if ($flowed && !empty($this->_body)) {
$flowed = new Horde_Text_Flowed($this->_body->getContents(), $this->_body->getCharset());
$flowed->setDelSp(true);
$this->_body->setContentTypeParameter('format', 'flowed');
$this->_body->setContentTypeParameter('DelSp', 'Yes');
$this->_body->setContents($flowed->toFlowed());
}
/* Build mime message. */
$body = new Horde_Mime_Part();
if (!empty($this->_body) && !empty($this->_htmlBody)) {
$body->setType('multipart/alternative');
$this->_body->setDescription(Horde_Mime_Translation::t("Plaintext Version of Message"));
$body->addPart($this->_body);
$this->_htmlBody->setDescription(Horde_Mime_Translation::t("HTML Version of Message"));
$body->addPart($this->_htmlBody);
} elseif (!empty($this->_htmlBody)) {
$body = $this->_htmlBody;
} elseif (!empty($this->_body)) {
$body = $this->_body;
}
if (count($this->_parts)) {
$basepart = new Horde_Mime_Part();
$basepart->setType('multipart/mixed');
$basepart->isBasePart(true);
if ($body) {
$basepart->addPart($body);
}
foreach ($this->_parts as $mime_part) {
$basepart->addPart($mime_part);
}
} else {
$basepart = $body;
$basepart->isBasePart(true);
}
}
$basepart->setHeaderCharset($this->_charset);
/* Build recipients. */
$recipients = clone $this->_recipients;
foreach (array('to', 'cc') as $header) {
$recipients->add($this->_headers->getOb($header));
}
if ($this->_bcc) {
$recipients->add($this->_bcc);
}
/* Trick Horde_Mime_Part into re-generating the message headers. */
$this->_headers->removeHeader('MIME-Version');
/* Send message. */
$recipients->unique();
$basepart->send($recipients->writeAddress(), $this->_headers, $mailer);
/* Remember the basepart */
$this->_base = $basepart;
}
示例3: replaceHeader
/**
*/
public function replaceHeader($header, $value, array $opts = array())
{
$this->_headers->removeHeader($header);
$this->_headers->addHeader($header, $value, $opts);
}