本文整理汇总了PHP中Horde_Mime_Headers::addReceivedHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Headers::addReceivedHeader方法的具体用法?PHP Horde_Mime_Headers::addReceivedHeader怎么用?PHP Horde_Mime_Headers::addReceivedHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Mime_Headers
的用法示例。
在下文中一共展示了Horde_Mime_Headers::addReceivedHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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->addReceivedHeader($this->_received_options);
$headers->addMessageIdHeader();
}
示例2: _handle
//.........这里部分代码省略.........
}
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->getAttribute('ORGANIZER'));
} catch (Horde_Icalendar_Exception $e) {
break;
}
$organizerEmail = $organizer['path'];
$organizer = $vFb->getAttribute('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->getAttribute('DTSTART');
} catch (Horde_Icalendar_Exception $e) {
$startStamp = time();
}
try {
$endStamp = $vFb->getAttribute('DTEND');
} catch (Horde_Icalendar_Exception $e) {
}
if (!$endStamp) {
try {
$duration = $vFb->getAttribute('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();
// Build the reply.
$msg_headers = new Horde_Mime_Headers();
$vCal = new Horde_Icalendar();
$vCal->setAttribute('PRODID', '-//The Horde Project//' . $msg_headers->getUserAgent() . '//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->addPart($body);
$mime->addPart($ics);
// Build the reply headers.
$msg_headers->addReceivedHeader(array('dns' => $injector->getInstance('Net_DNS2_Resolver'), 'server' => $conf['server']['name']));
$msg_headers->addMessageIdHeader();
$msg_headers->addHeader('Date', date('r'));
$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;
}
示例3: 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->addReceivedHeader(array('dns' => $injector->getInstance('Net_DNS2_Resolver'), 'server' => $conf['server']['name']));
$h->addMessageIdHeader();
$h->addUserAgentHeader();
$h->addHeader('Date', date('r'));
$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');
}
}