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


PHP Tinebase_Core::getTineUserAgent方法代码示例

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


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

示例1: send

 /**
  * send a notification as email
  *
  * @param Tinebase_Model_FullUser   $_updater
  * @param Addressbook_Model_Contact $_recipient
  * @param string                    $_subject the subject
  * @param string                    $_messagePlain the message as plain text
  * @param string                    $_messageHtml the message as html
  * @param string|array              $_attachments
  */
 public function send($_updater, Addressbook_Model_Contact $_recipient, $_subject, $_messagePlain, $_messageHtml = NULL, $_attachments = NULL)
 {
     // create mail object
     $mail = new Tinebase_Mail('UTF-8');
     // this seems to break some subjects, removing it for the moment
     // -> see 0004070: sometimes we can't decode message subjects (calendar notifications?)
     //$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
     $mail->setSubject($_subject);
     $mail->setBodyText($_messagePlain);
     if ($_messageHtml !== NULL) {
         $mail->setBodyHtml($_messageHtml);
     }
     // add header to identify mails sent by notification service / don't reply to this mail, dear autoresponder ... :)
     $mail->addHeader('X-Tine20-Type', 'Notification');
     $mail->addHeader('Precedence', 'bulk');
     $mail->addHeader('User-Agent', Tinebase_Core::getTineUserAgent('Notification Service'));
     if (empty($this->_fromAddress)) {
         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' No notification service address set. Could not send notification.');
         return;
     }
     if ($_updater !== NULL && !empty($_updater->accountEmailAddress)) {
         $mail->setFrom($_updater->accountEmailAddress, $_updater->accountFullName);
         $mail->setSender($this->_fromAddress, $this->_fromName);
     } else {
         $mail->setFrom($this->_fromAddress, $this->_fromName);
     }
     // attachments
     if (is_array($_attachments)) {
         $attachments =& $_attachments;
     } elseif (is_string($_attachments)) {
         $attachments = array(&$_attachments);
     } else {
         $attachments = array();
     }
     foreach ($attachments as $attachment) {
         if ($attachment instanceof Zend_Mime_Part) {
             $mail->addAttachment($attachment);
         } else {
             if (isset($attachment['filename'])) {
                 $mail->createAttachment($attachment['rawdata'], Zend_Mime::TYPE_OCTETSTREAM, Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $attachment['filename']);
             } else {
                 $mail->createAttachment($attachment);
             }
         }
     }
     // send
     if (!empty($_recipient->email)) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Send notification email to ' . $_recipient->email);
         }
         $mail->addTo($_recipient->email, $_recipient->n_fn);
         Tinebase_Smtp::getInstance()->sendMessage($mail);
     } else {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Not sending notification email to ' . $_recipient->n_fn . '. No email address available.');
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:66,代码来源:Smtp.php

示例2: testResourceNotification

 /**
  * testResourceNotification
  * 
  * checks if notification mail is sent to configured mail address of a resource
  * 
  * @see 0009954: resource manager and email handling
  *
  * @param boolean $suppress_notification
  */
 public function testResourceNotification($suppress_notification = false)
 {
     // create resource with email address of unittest user
     $resource = $this->_getResource();
     $resource->email = $this->_GetPersonasContacts('pwulf')->email;
     $resource->suppress_notification = $suppress_notification;
     $persistentResource = Calendar_Controller_Resource::getInstance()->create($resource);
     // create event with this resource as attender
     $event = $this->_getEvent(true);
     $event->attendee->addRecord($this->_createAttender($persistentResource->getId(), Calendar_Model_Attender::USERTYPE_RESOURCE));
     self::flushMailer();
     $persistentEvent = $this->_eventController->create($event);
     $this->assertEquals(3, count($persistentEvent->attendee));
     $messages = self::getMessages();
     if ($suppress_notification) {
         $this->assertEquals(2, count($messages), 'two mails should be send to attender (invite) + resource');
     } else {
         $this->assertEquals(2, count($messages), 'two mails should be send to current user (resource + attender)');
     }
     // assert user agent
     // @see 0011498: set user agent header for notification messages
     $headers = $messages[0]->getHeaders();
     $this->assertEquals(Tinebase_Core::getTineUserAgent('Notification Service'), $headers['User-Agent'][0]);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:33,代码来源:EventNotificationsTests.php

示例3: _setMailHeaders

 /**
  * set headers in mail to be sent
  * 
  * @param Tinebase_Mail $_mail
  * @param Felamimail_Model_Account $_account
  * @param Felamimail_Model_Message $_message
  */
 protected function _setMailHeaders(Zend_Mail $_mail, Felamimail_Model_Account $_account, Felamimail_Model_Message $_message = NULL)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Setting mail headers');
     }
     // add user agent
     $_mail->addHeader('User-Agent', Tinebase_Core::getTineUserAgent('Email Client'));
     // set organization
     if (isset($_account->organization) && !empty($_account->organization)) {
         $_mail->addHeader('Organization', $_account->organization);
     }
     // set message-id (we could use Zend_Mail::createMessageId() here)
     if ($_mail->getMessageId() === NULL) {
         $domainPart = substr($_account->email, strpos($_account->email, '@'));
         $uid = Tinebase_Record_Abstract::generateUID();
         $_mail->setMessageId('<' . $uid . $domainPart . '>');
     }
     if ($_message !== NULL) {
         if ($_message->flags && $_message->flags == Zend_Mail_Storage::FLAG_ANSWERED && $_message->original_id instanceof Felamimail_Model_Message) {
             $this->_addReplyHeaders($_message);
         }
         // set the header request response
         if ($_message->reading_conf) {
             $_mail->addHeader('Disposition-Notification-To', $_message->from_email);
         }
         // add other headers
         if (!empty($_message->headers) && is_array($_message->headers)) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Adding custom headers: ' . print_r($_message->headers, TRUE));
             }
             foreach ($_message->headers as $key => $value) {
                 $value = $this->_trimHeader($key, $value);
                 $_mail->addHeader($key, $value);
             }
         }
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:44,代码来源:Send.php


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