当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Mime_Headers::addHeaderOb方法代码示例

本文整理汇总了PHP中Horde_Mime_Headers::addHeaderOb方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Headers::addHeaderOb方法的具体用法?PHP Horde_Mime_Headers::addHeaderOb怎么用?PHP Horde_Mime_Headers::addHeaderOb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Mime_Headers的用法示例。


在下文中一共展示了Horde_Mime_Headers::addHeaderOb方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: verifyIdentity

 /**
  * Sends a message to an email address supposed to be added to the
  * identity.
  *
  * A message is send to this address containing a time-sensitive link to
  * confirm that the address really belongs to that user.
  *
  * @param integer $id       The identity's ID.
  * @param string $old_addr  The old From: address.
  *
  * @throws Horde_Mime_Exception
  */
 public function verifyIdentity($id, $old_addr)
 {
     global $injector, $notification, $registry;
     $hash = strval(new Horde_Support_Randomid());
     $pref = $this->_confirmEmail();
     $pref[$hash] = $this->get($id);
     $pref[$hash][self::EXPIRE] = time() + self::EXPIRE_SECS;
     $this->_confirmEmail($pref);
     $new_addr = $this->getValue($this->_prefnames['from_addr'], $id);
     $confirm = Horde::url($registry->getServiceLink('emailconfirm')->add('h', $hash)->setRaw(true), true);
     $message = sprintf(Horde_Core_Translation::t("You have requested to add the email address \"%s\" to the list of your personal email addresses.\n\nGo to the following link to confirm that this is really your address:\n%s\n\nIf you don't know what this message means, you can delete it."), $new_addr, $confirm);
     $msg_headers = new Horde_Mime_Headers();
     $msg_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_UserAgent::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     $msg_headers->addHeader('To', $new_addr);
     $msg_headers->addHeader('From', $old_addr);
     $msg_headers->addHeader('Subject', Horde_Core_Translation::t("Confirm new email address"));
     $body = new Horde_Mime_Part();
     $body->setType('text/plain');
     $body->setContents(Horde_String::wrap($message, 76));
     $body->setCharset('UTF-8');
     $body->send($new_addr, $msg_headers, $injector->getInstance('Horde_Mail'));
     $notification->push(sprintf(Horde_Core_Translation::t("A message has been sent to \"%s\" to verify that this is really your address. The new email address is activated as soon as you confirm this message."), $new_addr), 'horde.message');
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:37,代码来源:Identity.php

示例2: getMessage

 /**
  * Return the response as a MIME message.
  *
  * @param Horde_Itip_Response_Type    $type    The response type.
  * @param Horde_Itip_Response_Options $options The options for the response.
  *
  * @return array A list of two object: The mime headers and the mime
  *               message.
  */
 public function getMessage(Horde_Itip_Response_Type $type, Horde_Itip_Response_Options $options)
 {
     $message = new Horde_Mime_Part();
     $message->setType('text/calendar');
     $options->prepareIcsMimePart($message);
     $message->setContents($this->getIcalendar($type, $options)->exportvCalendar());
     $message->setEOL("\r\n");
     $this->_setIcsFilename($message);
     $message->setContentTypeParameter('METHOD', 'REPLY');
     // Build the reply headers.
     $from = $this->_resource->getFrom();
     $reply_to = $this->_resource->getReplyTo();
     $headers = new Horde_Mime_Headers();
     $headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     $headers->addHeader('From', $from);
     $headers->addHeader('To', $this->_request->getOrganizer());
     if (!empty($reply_to) && $reply_to != $from) {
         $headers->addHeader('Reply-to', $reply_to);
     }
     $headers->addHeader('Subject', $type->getSubject());
     $options->prepareResponseMimeHeaders($headers);
     return array($headers, $message);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:32,代码来源:Response.php

示例3: generate

 /**
  * Generate the MDN according to the specifications listed in RFC
  * 3798 [3].
  *
  * @param boolean $action   Was this MDN type a result of a manual
  *                          action on part of the user?
  * @param boolean $sending  Was this MDN sent as a result of a manual
  *                          action on part of the user?
  * @param string $type      The type of action performed by the user.
  *                          Per RFC 3798 [3.2.6.2] the following types are
  *                          valid:
  *                            - deleted
  *                            - displayed
  * @param string $name      The name of the local server.
  * @param Horde_Mail_Transport $mailer  Mail transport object.
  * @param array $opts       Additional options:
  *   - charset: (string) Default charset.
  *              DEFAULT: NONE
  *   - from_addr: (string) From address.
  *                DEFAULT: NONE
  * @param array $mod        The list of modifications. Per RFC 3798
  *                          [3.2.6.3] the following modifications are
  *                          valid:
  *                            - error
  * @param array $err        If $mod is 'error', the additional
  *                          information to provide. Key is the type of
  *                          modification, value is the text.
  */
 public function generate($action, $sending, $type, $name, $mailer, array $opts = array(), array $mod = array(), array $err = array())
 {
     $opts = array_merge(array('charset' => null, 'from_addr' => null), $opts);
     if (!($hdr = $this->_headers[self::MDN_HEADER])) {
         throw new RuntimeException('Need at least one address to send MDN to.');
     }
     $to = $hdr->getAddressList(true);
     $ua = Horde_Mime_Headers_UserAgent::create();
     if ($orig_recip = $this->_headers['Original-Recipient']) {
         $orig_recip = $orig_recip->value_single;
     }
     /* Set up the mail headers. */
     $msg_headers = new Horde_Mime_Headers();
     $msg_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     $msg_headers->addHeaderOb($ua);
     /* RFC 3834 [5.2] */
     $msg_headers->addHeader('Auto-Submitted', 'auto-replied');
     $msg_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     if ($opts['from_addr']) {
         $msg_headers->addHeader('From', $opts['from_addr']);
     }
     $msg_headers->addHeader('To', $to);
     $msg_headers->addHeader('Subject', Horde_Mime_Translation::t("Disposition Notification"));
     /* MDNs are a subtype of 'multipart/report'. */
     $msg = new Horde_Mime_Part();
     $msg->setType('multipart/report');
     $msg->setContentTypeParameter('report-type', 'disposition-notification');
     /* The first part is a human readable message. */
     $part_one = new Horde_Mime_Part();
     $part_one->setType('text/plain');
     $part_one->setCharset($opts['charset']);
     if ($type == 'displayed') {
         $contents = sprintf(Horde_Mime_Translation::t("The message sent on %s to %s with subject \"%s\" has been displayed.\n\nThis is no guarantee that the message has been read or understood."), $this->_headers['Date'], $this->_headers['To'], $this->_headers['Subject']);
         $flowed = new Horde_Text_Flowed($contents, $opts['charset']);
         $flowed->setDelSp(true);
         $part_one->setContentTypeParameter('format', 'flowed');
         $part_one->setContentTypeParameter('DelSp', 'Yes');
         $part_one->setContents($flowed->toFlowed());
     }
     // TODO: Messages for other notification types.
     $msg[] = $part_one;
     /* The second part is a machine-parseable description. */
     $part_two = new Horde_Mime_Part();
     $part_two->setType('message/disposition-notification');
     $part_two_h = new Horde_Mime_Headers();
     $part_two_h->addHeader('Reporting-UA', $name . '; ' . $ua);
     if (!empty($orig_recip)) {
         $part_two_h->addHeader('Original-Recipient', 'rfc822;' . $orig_recip);
     }
     if ($opts['from_addr']) {
         $part_two_h->addHeader('Final-Recipient', 'rfc822;' . $opts['from_addr']);
     }
     if ($msg_id = $this->_headers['Message-ID']) {
         $part_two_h->addHeader('Original-Message-ID', strval($msg_id));
     }
     /* Create the Disposition field now (RFC 3798 [3.2.6]). */
     $dispo = ($action ? 'manual-action' : 'automatic-action') . '/' . ($sending ? 'MDN-sent-manually' : 'MDN-sent-automatically') . '; ' . $type;
     if (!empty($mod)) {
         $dispo .= '/' . implode(', ', $mod);
     }
     $part_two_h->addHeader('Disposition', $dispo);
     if (in_array('error', $mod) && isset($err['error'])) {
         $part_two_h->addHeader('Error', $err['error']);
     }
     $part_two->setContents(trim($part_two_h->toString()) . "\n");
     $msg[] = $part_two;
     /* The third part is the text of the original message.  RFC 3798 [3]
      * allows us to return only a portion of the entire message - this
      * is left up to the user. */
     $part_three = new Horde_Mime_Part();
     $part_three->setType('message/rfc822');
     $part_three_text = array(trim($this->_headers->toString()) . "\n");
//.........这里部分代码省略.........
开发者ID:x59,项目名称:horde-mime,代码行数:101,代码来源:Mdn.php

示例4: prepareResponseMimeHeaders

 /**
  * Prepare the iCalendar MIME part of the response message.
  *
  * @param Horde_Mime_Part $ics The iCalendar MIME part of the response
  *                             message.
  *
  * @return NULL
  */
 public function prepareResponseMimeHeaders(Horde_Mime_Headers $headers)
 {
     $headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:12,代码来源:Horde.php

示例5: testAddHeaderOb

 /**
  * @dataProvider addHeaderObProvider
  */
 public function testAddHeaderOb($ob, $valid)
 {
     $hdrs = new Horde_Mime_Headers();
     try {
         $hdrs->addHeaderOb($ob, true);
         if (!$valid) {
             $this->fail();
         }
     } catch (InvalidArgumentException $e) {
         if ($valid) {
             $this->fail();
         }
         return;
     }
     $this->assertEquals($ob, $hdrs[$ob->name]);
 }
开发者ID:horde,项目名称:horde,代码行数:19,代码来源:HeadersTest.php

示例6: _handle


//.........这里部分代码省略.........
                     $notification->push(_("This action is not supported."), 'horde.warning');
                 }
                 break;
             case 'send':
             case 'reply':
             case 'reply2m':
                 // vfreebusy request.
                 if (isset($components[$key]) && $components[$key]->getType() == 'vFreebusy') {
                     $vFb = $components[$key];
                     // Get the organizer details.
                     try {
                         $organizer = parse_url($vFb->getAttributeSingle('ORGANIZER'));
                     } catch (Horde_Icalendar_Exception $e) {
                         break;
                     }
                     $organizerEmail = $organizer['path'];
                     $organizer = $vFb->getAttributeSingle('ORGANIZER', true);
                     $organizerFullEmail = new Horde_Mail_Rfc822_Address($organizerEmail);
                     if (isset($organizer['cn'])) {
                         $organizerFullEmail->personal = $organizer['cn'];
                     }
                     if ($action == 'reply2m') {
                         $startStamp = time();
                         $endStamp = $startStamp + 60 * 24 * 3600;
                     } else {
                         try {
                             $startStamp = $vFb->getAttributeSingle('DTSTART');
                         } catch (Horde_Icalendar_Exception $e) {
                             $startStamp = time();
                         }
                         try {
                             $endStamp = $vFb->getAttributeSingle('DTEND');
                         } catch (Horde_Icalendar_Exception $e) {
                         }
                         if (!$endStamp) {
                             try {
                                 $duration = $vFb->getAttributeSingle('DURATION');
                                 $endStamp = $startStamp + $duration;
                             } catch (Horde_Icalendar_Exception $e) {
                                 $endStamp = $startStamp + 60 * 24 * 3600;
                             }
                         }
                     }
                     $vfb_reply = $registry->call('calendar/getFreeBusy', array($startStamp, $endStamp));
                     // Find out who we are and update status.
                     $identity = $injector->getInstance('IMP_Identity');
                     $email = $identity->getFromAddress();
                     $vCal = new Horde_Icalendar();
                     $vCal->setAttribute('PRODID', '-//The Horde Project//' . strval(Horde_Mime_Headers_UserAgent::create()) . '//EN');
                     $vCal->setAttribute('METHOD', 'REPLY');
                     $vCal->addComponent($vfb_reply);
                     $message = _("Attached is a reply to a calendar request you sent.");
                     $body = new Horde_Mime_Part();
                     $body->setType('text/plain');
                     $body->setCharset('UTF-8');
                     $body->setContents(Horde_String::wrap($message, 76));
                     $ics = new Horde_Mime_Part();
                     $ics->setType('text/calendar');
                     $ics->setCharset('UTF-8');
                     $ics->setContents($vCal->exportvCalendar());
                     $ics->setName('icalendar.ics');
                     $ics->setContentTypeParameter('METHOD', 'REPLY');
                     $mime = new Horde_Mime_Part();
                     $mime[] = $body;
                     $mime[] = $ics;
                     // Build the reply headers.
                     $msg_headers = new Horde_Mime_Headers();
                     $msg_headers->addHeaderOb(Horde_Core_Mime_Headers_Received::createHordeHop());
                     $msg_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
                     $msg_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
                     $msg_headers->addHeader('From', $email);
                     $msg_headers->addHeader('To', $organizerFullEmail);
                     $identity->setDefault($vars->identity);
                     $replyto = $identity->getValue('replyto_addr');
                     if (!empty($replyto) && !$email->match($replyto)) {
                         $msg_headers->addHeader('Reply-To', $replyto);
                     }
                     $msg_headers->addHeader('Subject', _("Free/Busy Request Response"));
                     // Send the reply.
                     try {
                         $mime->send($organizerEmail, $msg_headers, $injector->getInstance('IMP_Mail'));
                         $notification->push(_("Reply Sent."), 'horde.success');
                         $result = true;
                     } catch (Exception $e) {
                         $notification->push(sprintf(_("Error sending reply: %s."), $e->getMessage()), 'horde.error');
                     }
                 } else {
                     $notification->push(_("Invalid Action selected for this component."), 'horde.warning');
                 }
                 break;
             case 'nosup':
                 // vFreebusy request.
             // vFreebusy request.
             default:
                 $notification->push(_("This action is not supported."), 'horde.warning');
                 break;
         }
     }
     return $result;
 }
开发者ID:horde,项目名称:horde,代码行数:101,代码来源:ItipRequest.php

示例7: setContentId

 /**
  * 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();
 }
开发者ID:x59,项目名称:horde-mime,代码行数:16,代码来源:Part.php

示例8: report

 /**
  */
 public function report(array $msgs, $action)
 {
     global $injector;
     $ret = 0;
     switch ($this->_format) {
         case 'redirect':
             /* Send the message. */
             foreach ($msgs as $val) {
                 try {
                     $imp_compose = $injector->getInstance('IMP_Factory_Compose')->create();
                     $imp_compose->redirectMessage($val->getIndicesOb());
                     $imp_compose->sendRedirectMessage($this->_email, false);
                     ++$ret;
                 } catch (IMP_Compose_Exception $e) {
                     $e->log();
                 }
             }
             break;
         case 'digest':
         default:
             try {
                 $from_line = $injector->getInstance('IMP_Identity')->getFromLine();
             } catch (Horde_Exception $e) {
                 $from_line = null;
             }
             $self = $this;
             $reportDigest = function ($m) use($action, $from_line, $self) {
                 global $injector, $registry;
                 if (empty($m)) {
                     return 0;
                 }
                 /* Build the MIME structure. */
                 $mime = new Horde_Mime_Part();
                 $mime->setType('multipart/digest');
                 foreach ($m as $val) {
                     $rfc822 = new Horde_Mime_Part();
                     $rfc822->setType('message/rfc822');
                     $rfc822->setContents($val->fullMessageText(array('stream' => true)));
                     $mime[] = $rfc822;
                 }
                 $spam_headers = new Horde_Mime_Headers();
                 $spam_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
                 $spam_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
                 $spam_headers->addHeader('To', $this->_email);
                 if (!is_null($from_line)) {
                     $spam_headers->addHeader('From', $from_line);
                 }
                 $spam_headers->addHeader('Subject', sprintf(_("%s report from %s"), $action === IMP_Spam::SPAM ? 'spam' : 'innocent', $registry->getAuth()));
                 /* Send the message. */
                 try {
                     $imp_compose = $injector->getInstance('IMP_Factory_Compose')->create();
                     $recip_list = $imp_compose->recipientList(array('to' => $this->_email));
                     $imp_compose->sendMessage($recip_list['list'], $spam_headers, $mime, 'UTF-8');
                     return count($m);
                 } catch (IMP_Compose_Exception $e) {
                     $e->log();
                     return 0;
                 }
             };
             $mlimit = $orig_mlimit = empty($this->_opts['digest_limit_msgs']) ? null : $this->_opts['digest_limit_msgs'];
             $slimit = $orig_slimit = empty($this->_opts['digest_limit_size']) ? null : $this->_opts['digest_limit_size'];
             $todo = array();
             foreach ($msgs as $val) {
                 $process = false;
                 $todo[] = $val;
                 if (!is_null($mlimit) && !--$mlimit) {
                     $process = true;
                 }
                 if (!is_null($slimit) && ($slimit -= $val->getMIMEMessage()->getBytes()) < 0) {
                     $process = true;
                     /* If we have exceeded size limits with this single
                      * message, it exceeds the maximum limit and we can't
                      * send it at all. Don't confuse the user and instead
                      * report is as a "success" for UI purposes. */
                     if (count($todo) === 1) {
                         ++$ret;
                         $todo = array();
                         Horde::log('Could not send spam/innocent reporting message because original message was too large.', 'NOTICE');
                     }
                 }
                 if ($process) {
                     $ret += $reportDigest($todo);
                     $todo = array();
                     $mlimit = $orig_mlimit;
                     $slimit = $orig_slimit;
                 }
             }
             $ret += $reportDigest($todo);
             break;
     }
     return $ret;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:94,代码来源:Email.php

示例9: _prepareHeaders

 /**
  * Prepare header object with basic header fields and converts headers
  * to the current compose charset.
  *
  * @param array $headers  Array with 'from', 'to', 'cc', 'bcc', and
  *                        'subject' values.
  * @param array $opts     An array of options w/the following keys:
  *   - priority: (string) The message priority ('high', 'normal', 'low').
  *
  * @return Horde_Mime_Headers  Headers object with the appropriate headers
  *                             set.
  */
 protected function _prepareHeaders($headers, array $opts = array())
 {
     $ob = new Horde_Mime_Headers();
     $ob->addHeaderOb(Horde_Mime_Headers_Date::create());
     $ob->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     $hdrs = array('From' => 'from', 'To' => 'to', 'Cc' => 'cc', 'Bcc' => 'bcc', 'Subject' => 'subject');
     foreach ($hdrs as $key => $val) {
         if (isset($headers[$val]) && (is_object($headers[$val]) || strlen($headers[$val]))) {
             $ob->addHeader($key, $headers[$val]);
         }
     }
     if ($this->replyType(true) == self::REPLY) {
         if ($refs = $this->getMetadata('references')) {
             $ob->addHeader('References', implode(' ', $refs));
         }
         if ($this->getMetadata('in_reply_to')) {
             $ob->addHeader('In-Reply-To', $this->getMetadata('in_reply_to'));
         }
     }
     /* Add priority header, if requested. */
     if (!empty($opts['priority'])) {
         switch ($opts['priority']) {
             case 'high':
                 $ob->addHeader('Importance', 'High');
                 $ob->addHeader('X-Priority', '1 (Highest)');
                 break;
             case 'low':
                 $ob->addHeader('Importance', 'Low');
                 $ob->addHeader('X-Priority', '5 (Lowest)');
                 break;
         }
     }
     /* Add Return Receipt Headers. */
     if (!empty($opts['readreceipt']) && ($h = $ob['from'])) {
         $from = $h->getAddressList(true);
         if (is_null($from->host)) {
             $from->host = $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create()->config->maildomain;
         }
         $mdn = new Horde_Mime_Mdn($ob);
         $mdn->addMdnRequestHeaders($from);
     }
     return $ob;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:55,代码来源:Compose.php

示例10: prepareResponseMimeHeaders

 /**
  */
 public function prepareResponseMimeHeaders(Horde_Mime_Headers $headers)
 {
     $headers->addHeaderOb(Horde_Core_Mime_Headers_Received::createHordeHop());
     parent::prepareResponseMimeHeaders($headers);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:7,代码来源:Horde.php

示例11: sendNotification

 /**
  * Send notification to attachment owner.
  */
 public function sendNotification()
 {
     global $conf, $injector, $registry;
     if (empty($conf['compose']['link_attachments_notify'])) {
         return;
     }
     try {
         $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create($this->_user);
         $address = $identity->getDefaultFromAddress();
         /* Ignore missing addresses, which are returned as <>. */
         if (strlen($address) < 3 || $this->_getDeleteToken()) {
             return;
         }
         $address_full = $identity->getDefaultFromAddress(true);
         /* Load user prefs to correctly translate gettext strings. */
         if (!$registry->getAuth()) {
             $prefs = $injector->getInstance('Horde_Core_Factory_Prefs')->create('imp', array('user' => $this->_user));
             $registry->setLanguageEnvironment($prefs->getValue('language'));
         }
         $h = new Horde_Mime_Headers();
         $h->addHeaderOb(Horde_Core_Mime_Headers_Received::createHordeHop());
         $h->addHeaderOb(Horde_Mime_Headers_MessageId::create());
         $h->addHeaderOb(Horde_Mime_Headers_UserAgent::create());
         $h->addHeaderOb(Horde_Mime_Headers_Date::create());
         $h->addHeader('From', $address_full);
         $h->addHeader('To', $address_full);
         $h->addHeader('Subject', _("Notification: Linked attachment downloaded"));
         $h->addHeader('Auto-Submitted', 'auto-generated');
         $msg = new Horde_Mime_Part();
         $msg->setType('text/plain');
         $msg->setCharset('UTF-8');
         $md = $this->_atc->getMetadata();
         $msg->setContents(Horde_String::wrap(_("Your linked attachment has been downloaded by at least one user.") . "\n\n" . sprintf(_("Name: %s"), $md->filename) . "\n" . sprintf(_("Type: %s"), $md->type) . "\n" . sprintf(_("Sent Date: %s"), date('r', $md->time)) . "\n\n" . _("Click on the following link to permanently delete the attachment:") . "\n" . strval($this->_atc->link_url->add('d', $this->_getDeleteToken(true)))));
         $msg->send($address, $h, $injector->getInstance('Horde_Mail'));
     } catch (Exception $e) {
         Horde::log($e, 'ERR');
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:41,代码来源:LinkedAttachment.php

示例12: addReceivedHeader

 /**
  */
 public function addReceivedHeader(array $opts = array())
 {
     $old_error = error_reporting(0);
     if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         /* This indicates the user is connecting through a proxy. */
         $remote_path = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
         $remote_addr = $remote_path[0];
         if (!empty($opts['dns'])) {
             $remote = $remote_addr;
             try {
                 if ($response = $opts['dns']->query($remote_addr, 'PTR')) {
                     foreach ($response->answer as $val) {
                         if (isset($val->ptrdname)) {
                             $remote = $val->ptrdname;
                             break;
                         }
                     }
                 }
             } catch (Net_DNS2_Exception $e) {
             }
         } else {
             $remote = gethostbyaddr($remote_addr);
         }
     } else {
         $remote_addr = $_SERVER['REMOTE_ADDR'];
         if (empty($_SERVER['REMOTE_HOST'])) {
             if (!empty($opts['dns'])) {
                 $remote = $remote_addr;
                 try {
                     if ($response = $opts['dns']->query($remote_addr, 'PTR')) {
                         foreach ($response->answer as $val) {
                             if (isset($val->ptrdname)) {
                                 $remote = $val->ptrdname;
                                 break;
                             }
                         }
                     }
                 } catch (Net_DNS2_Exception $e) {
                 }
             } else {
                 $remote = gethostbyaddr($remote_addr);
             }
         } else {
             $remote = $_SERVER['REMOTE_HOST'];
         }
     }
     error_reporting($old_error);
     if (!empty($_SERVER['REMOTE_IDENT'])) {
         $remote_ident = $_SERVER['REMOTE_IDENT'] . '@' . $remote . ' ';
     } elseif ($remote != $_SERVER['REMOTE_ADDR']) {
         $remote_ident = $remote . ' ';
     } else {
         $remote_ident = '';
     }
     if (!empty($opts['server'])) {
         $server_name = $opts['server'];
     } elseif (!empty($_SERVER['SERVER_NAME'])) {
         $server_name = $_SERVER['SERVER_NAME'];
     } elseif (!empty($_SERVER['HTTP_HOST'])) {
         $server_name = $_SERVER['HTTP_HOST'];
     } else {
         $server_name = 'unknown';
     }
     $is_ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
     $this->_headers->addHeaderOb(new Horde_Mime_Headers_Element_Multiple('Received', 'from ' . $remote . ' (' . $remote_ident . '[' . $remote_addr . ']) ' . 'by ' . $server_name . ' (Horde Framework) with HTTP' . ($is_ssl ? 'S' : '') . '; ' . date('r')));
 }
开发者ID:x59,项目名称:horde-mime,代码行数:68,代码来源:Deprecated.php

示例13: 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. */
     if (!$resend || !isset($this->_headers['Message-ID'])) {
         $this->_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     }
     if (!isset($this->_headers['User-Agent'])) {
         $this->_headers->addHeaderOb(Horde_Mime_Headers_UserAgent::create());
     }
     if (!$resend || !isset($this->_headers['Date'])) {
         $this->_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     }
     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[] = $this->_body;
             $this->_htmlBody->setDescription(Horde_Mime_Translation::t("HTML Version of Message"));
             $body[] = $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[] = $body;
             }
             foreach ($this->_parts as $mime_part) {
                 $basepart[] = $mime_part;
             }
         } else {
             $basepart = $body;
             $basepart->isBasePart(true);
         }
     }
     $basepart->setHeaderCharset($this->_charset);
     /* Build recipients. */
     $recipients = clone $this->_recipients;
     foreach (array('to', 'cc') as $header) {
         if ($h = $this->_headers[$header]) {
             $recipients->add($h->getAddressList());
         }
     }
     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;
 }
开发者ID:x59,项目名称:horde-mime,代码行数:80,代码来源:Mail.php

示例14: _reportDigest

 /**
  * Builds and sends a digest message.
  *
  * @param array $messages  List of message contents (string|resource).
  * @param integer $action  Either Horde_Spam::SPAM or Horde_Spam::INNOCENT.
  *
  * @return integer  The number of reported messages.
  */
 protected function _reportDigest(array $messages, $action)
 {
     if (empty($messages)) {
         return 0;
     }
     /* Build the MIME structure. */
     $mime = new Horde_Mime_Part();
     $mime->setType('multipart/digest');
     foreach ($messages as $val) {
         $rfc822 = new Horde_Mime_Part();
         $rfc822->setType('message/rfc822');
         $rfc822->setContents($val);
         $mime[] = $rfc822;
     }
     $spam_headers = new Horde_Mime_Headers();
     $spam_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     $spam_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     $spam_headers->addHeader('To', $this->_email);
     $spam_headers->addHeader('From', $this->_from_addr);
     $spam_headers->addHeader('Subject', sprintf(Horde_Spam_Translation::t("%s report from %s"), $action === Horde_Spam::SPAM ? 'spam' : 'innocent', $this->_user));
     /* Send the message. */
     try {
         $mime->send($this->_email, $spam_headers, $this->_mail);
         return count($messages);
     } catch (Horde_Mail_Exception $e) {
         $this->_logger->warn($e);
         return 0;
     }
 }
开发者ID:horde,项目名称:horde,代码行数:37,代码来源:Email.php


注:本文中的Horde_Mime_Headers::addHeaderOb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。