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


PHP mapi_message_modifyrecipients函数代码示例

本文整理汇总了PHP中mapi_message_modifyrecipients函数的典型用法代码示例。如果您正苦于以下问题:PHP mapi_message_modifyrecipients函数的具体用法?PHP mapi_message_modifyrecipients怎么用?PHP mapi_message_modifyrecipients使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setAppointment


//.........这里部分代码省略.........
                     }
                     if (isset($exception->endtime)) {
                         $mapiexception["end"] = $this->getLocaltimeByTZ($exception->endtime, $tz);
                         $exceptionprops[$appointmentprops["endtime"]] = $exception->endtime;
                     }
                     if (isset($exception->subject)) {
                         $exceptionprops[$appointmentprops["subject"]] = $mapiexception["subject"] = u2w($exception->subject);
                     }
                     if (isset($exception->location)) {
                         $exceptionprops[$appointmentprops["location"]] = $mapiexception["location"] = u2w($exception->location);
                     }
                     if (isset($exception->busystatus)) {
                         $exceptionprops[$appointmentprops["busystatus"]] = $mapiexception["busystatus"] = $exception->busystatus;
                     }
                     if (isset($exception->reminder)) {
                         $exceptionprops[$appointmentprops["reminderset"]] = $mapiexception["reminder_set"] = 1;
                         $exceptionprops[$appointmentprops["remindertime"]] = $mapiexception["remind_before"] = $exception->reminder;
                     }
                     if (isset($exception->alldayevent)) {
                         $exceptionprops[$appointmentprops["alldayevent"]] = $mapiexception["alldayevent"] = $exception->alldayevent;
                     }
                     if (!isset($recur["changed_occurences"])) {
                         $recur["changed_occurences"] = array();
                     }
                     if (isset($exception->body)) {
                         $exceptionprops[$appointmentprops["body"]] = u2w($exception->body);
                     }
                     array_push($recur["changed_occurences"], $mapiexception);
                     if (!empty($exceptionprops)) {
                         $noexceptions = false;
                         if ($recurrence->isException($basedate)) {
                             $recurrence->modifyException($exceptionprops, $basedate);
                         } else {
                             $recurrence->createException($exceptionprops, $basedate);
                         }
                     }
                 }
             }
         }
         //setRecurrence deletes the attachments from an appointment
         if ($noexceptions) {
             $recurrence->setRecurrence($tz, $recur);
         }
     } else {
         $props[$appointmentprops["isrecurring"]] = false;
     }
     //always set the PR_SENT_REPRESENTING_* props so that the attendee status update also works with the webaccess
     $p = array($appointmentprops["representingentryid"], $appointmentprops["representingname"], $appointmentprops["sentrepresentingaddt"], $appointmentprops["sentrepresentingemail"], $appointmentprops["sentrepresentinsrchk"]);
     $representingprops = $this->getProps($mapimessage, $p);
     if (!isset($representingprops[$appointmentprops["representingentryid"]])) {
         $props[$appointmentprops["representingname"]] = Request::GetAuthUser();
         $props[$appointmentprops["sentrepresentingemail"]] = Request::GetAuthUser();
         $props[$appointmentprops["sentrepresentingaddt"]] = "ZARAFA";
         $props[$appointmentprops["representingentryid"]] = mapi_createoneoff(Request::GetAuthUser(), "ZARAFA", Request::GetAuthUser());
         $props[$appointmentprops["sentrepresentinsrchk"]] = $props[$appointmentprops["sentrepresentingaddt"]] . ":" . $props[$appointmentprops["sentrepresentingemail"]];
     }
     // Do attendees
     if (isset($appointment->attendees) && is_array($appointment->attendees)) {
         $recips = array();
         // Outlook XP requires organizer in the attendee list as well
         $org = array();
         $org[PR_ENTRYID] = isset($representingprops[$appointmentprops["representingentryid"]]) ? $representingprops[$appointmentprops["representingentryid"]] : $props[$appointmentprops["representingentryid"]];
         $org[PR_DISPLAY_NAME] = isset($representingprops[$appointmentprops["representingname"]]) ? $representingprops[$appointmentprops["representingname"]] : $props[$appointmentprops["representingname"]];
         $org[PR_ADDRTYPE] = isset($representingprops[$appointmentprops["sentrepresentingaddt"]]) ? $representingprops[$appointmentprops["sentrepresentingaddt"]] : $props[$appointmentprops["sentrepresentingaddt"]];
         $org[PR_EMAIL_ADDRESS] = isset($representingprops[$appointmentprops["sentrepresentingemail"]]) ? $representingprops[$appointmentprops["sentrepresentingemail"]] : $props[$appointmentprops["sentrepresentingemail"]];
         $org[PR_SEARCH_KEY] = isset($representingprops[$appointmentprops["sentrepresentinsrchk"]]) ? $representingprops[$appointmentprops["sentrepresentinsrchk"]] : $props[$appointmentprops["sentrepresentinsrchk"]];
         $org[PR_RECIPIENT_FLAGS] = recipOrganizer | recipSendable;
         $org[PR_RECIPIENT_TYPE] = MAPI_TO;
         array_push($recips, $org);
         //open addresss book for user resolve
         $addrbook = $this->getAddressbook();
         foreach ($appointment->attendees as $attendee) {
             $recip = array();
             $recip[PR_EMAIL_ADDRESS] = u2w($attendee->email);
             // lookup information in GAB if possible so we have up-to-date name for given address
             $userinfo = array(array(PR_DISPLAY_NAME => $recip[PR_EMAIL_ADDRESS]));
             $userinfo = mapi_ab_resolvename($addrbook, $userinfo, EMS_AB_ADDRESS_LOOKUP);
             if (mapi_last_hresult() == NOERROR) {
                 $recip[PR_DISPLAY_NAME] = $userinfo[0][PR_DISPLAY_NAME];
                 $recip[PR_EMAIL_ADDRESS] = $userinfo[0][PR_EMAIL_ADDRESS];
                 $recip[PR_SEARCH_KEY] = $userinfo[0][PR_SEARCH_KEY];
                 $recip[PR_ADDRTYPE] = $userinfo[0][PR_ADDRTYPE];
                 $recip[PR_ENTRYID] = $userinfo[0][PR_ENTRYID];
                 $recip[PR_RECIPIENT_TYPE] = MAPI_TO;
                 $recip[PR_RECIPIENT_FLAGS] = recipSendable;
             } else {
                 $recip[PR_DISPLAY_NAME] = u2w($attendee->name);
                 $recip[PR_SEARCH_KEY] = "SMTP:" . $recip[PR_EMAIL_ADDRESS] . "";
                 $recip[PR_ADDRTYPE] = "SMTP";
                 $recip[PR_RECIPIENT_TYPE] = MAPI_TO;
                 $recip[PR_ENTRYID] = mapi_createoneoff($recip[PR_DISPLAY_NAME], $recip[PR_ADDRTYPE], $recip[PR_EMAIL_ADDRESS]);
             }
             array_push($recips, $recip);
         }
         mapi_message_modifyrecipients($mapimessage, 0, $recips);
         $props[$appointmentprops["icon"]] = 1026;
         $props[$appointmentprops["mrwassent"]] = true;
     }
     mapi_setprops($mapimessage, $props);
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:101,代码来源:mapiprovider.php

示例2: regenerateTask

 /**
  * Function which clones current occurrence and sets appropriate properties.
  * The original recurring item is moved to next occurrence.
  *@param boolean $markComplete true if existing occurrence has to be mark complete else false.
  */
 function regenerateTask($markComplete)
 {
     // Get all properties
     $taskItemProps = mapi_getprops($this->message);
     if (isset($this->action["subject"])) {
         $taskItemProps[$this->proptags["subject"]] = $this->action["subject"];
     }
     if (isset($this->action["importance"])) {
         $taskItemProps[$this->proptags["importance"]] = $this->action["importance"];
     }
     if (isset($this->action["startdate"])) {
         $taskItemProps[$this->proptags["startdate"]] = $this->action["startdate"];
         $taskItemProps[$this->proptags["commonstart"]] = $this->action["startdate"];
     }
     if (isset($this->action["duedate"])) {
         $taskItemProps[$this->proptags["duedate"]] = $this->action["duedate"];
         $taskItemProps[$this->proptags["commonend"]] = $this->action["duedate"];
     }
     $folder = mapi_msgstore_openentry($this->store, $taskItemProps[PR_PARENT_ENTRYID]);
     $newMessage = mapi_folder_createmessage($folder);
     $taskItemProps[$this->proptags["status"]] = $markComplete ? olTaskComplete : olTaskNotStarted;
     $taskItemProps[$this->proptags["complete"]] = $markComplete;
     $taskItemProps[$this->proptags["percent_complete"]] = $markComplete ? 1 : 0;
     // This occurrence has been marked as 'Complete' so disable reminder
     if ($markComplete) {
         $taskItemProps[$this->proptags["reset_reminder"]] = false;
         $taskItemProps[$this->proptags["reminder"]] = false;
         $taskItemProps[$this->proptags["datecompleted"]] = $this->action["datecompleted"];
         unset($this->action[$this->proptags['datecompleted']]);
     }
     // Recurrence ends for this item
     $taskItemProps[$this->proptags["dead_occurrence"]] = true;
     $taskItemProps[$this->proptags["task_f_creator"]] = true;
     //OL props
     $taskItemProps[$this->proptags["side_effects"]] = 1296;
     $taskItemProps[$this->proptags["icon_index"]] = 1280;
     // Copy recipients
     $recipienttable = mapi_message_getrecipienttable($this->message);
     $recipients = mapi_table_queryallrows($recipienttable, array(PR_ENTRYID, PR_DISPLAY_NAME, PR_EMAIL_ADDRESS, PR_RECIPIENT_ENTRYID, PR_RECIPIENT_TYPE, PR_SEND_INTERNET_ENCODING, PR_SEND_RICH_INFO, PR_RECIPIENT_DISPLAY_NAME, PR_ADDRTYPE, PR_DISPLAY_TYPE, PR_RECIPIENT_TRACKSTATUS, PR_RECIPIENT_TRACKSTATUS_TIME, PR_RECIPIENT_FLAGS, PR_ROWID));
     $copy_to_recipientTable = mapi_message_getrecipienttable($newMessage);
     $copy_to_recipientRows = mapi_table_queryallrows($copy_to_recipientTable, array(PR_ROWID));
     foreach ($copy_to_recipientRows as $recipient) {
         mapi_message_modifyrecipients($newMessage, MODRECIP_REMOVE, array($recipient));
     }
     mapi_message_modifyrecipients($newMessage, MODRECIP_ADD, $recipients);
     // Copy attachments
     $attachmentTable = mapi_message_getattachmenttable($this->message);
     if ($attachmentTable) {
         $attachments = mapi_table_queryallrows($attachmentTable, array(PR_ATTACH_NUM, PR_ATTACH_SIZE, PR_ATTACH_LONG_FILENAME, PR_ATTACHMENT_HIDDEN, PR_DISPLAY_NAME, PR_ATTACH_METHOD));
         foreach ($attachments as $attach_props) {
             $attach_old = mapi_message_openattach($this->message, (int) $attach_props[PR_ATTACH_NUM]);
             $attach_newResourceMsg = mapi_message_createattach($newMessage);
             mapi_copyto($attach_old, array(), array(), $attach_newResourceMsg, 0);
             mapi_savechanges($attach_newResourceMsg);
         }
     }
     mapi_setprops($newMessage, $taskItemProps);
     mapi_savechanges($newMessage);
     // Update body of original message
     $msgbody = mapi_message_openproperty($this->message, PR_BODY);
     $msgbody = trim($this->windows1252_to_utf8($msgbody), "");
     $separator = "------------\r\n";
     if (!empty($msgbody) && strrpos($msgbody, $separator) === false) {
         $msgbody = $separator . $msgbody;
         $stream = mapi_openpropertytostream($this->message, PR_BODY, MAPI_CREATE | MAPI_MODIFY);
         mapi_stream_setsize($stream, strlen($msgbody));
         mapi_stream_write($stream, $msgbody);
         mapi_stream_commit($stream);
     }
     // We need these properties to notify client
     return mapi_getprops($newMessage, array(PR_ENTRYID, PR_PARENT_ENTRYID, PR_STORE_ENTRYID));
 }
开发者ID:alanturing1,项目名称:Z-Push-contrib,代码行数:77,代码来源:class.taskrecurrence.php

示例3: clearRecipientResponse

 /**
  * Clear responses of all attendees who have replied in past.
  * @param MAPI_MESSAGE $message on which responses should be cleared
  */
 function clearRecipientResponse($message)
 {
     $recipTable = mapi_message_getrecipienttable($message);
     $recipsRows = mapi_table_queryallrows($recipTable, $this->recipprops);
     foreach ($recipsRows as $recipient) {
         if (($recipient[PR_RECIPIENT_FLAGS] & recipOrganizer) != recipOrganizer) {
             // Recipient is attendee, set the trackstatus to "Not Responded"
             $recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
         } else {
             // Recipient is organizer, this is not possible, but for safety
             // it is best to clear the trackstatus for him as well by setting
             // the trackstatus to "Organized".
             $recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
         }
         mapi_message_modifyrecipients($message, MODRECIP_MODIFY, array($recipient));
     }
 }
开发者ID:netconstructor,项目名称:sogosync,代码行数:21,代码来源:class.meetingrequest.php

示例4: setAllExceptionRecipients

 /**
  * Function which applies the provided recipients to the exception, also checks for deleted recipients.
  *
  * The $exception_recips should be an array containing all recipients which must be applied
  * to the exception. This will copy all recipients from the original message and then start filter
  * out all recipients which are not provided by the $exception_recips list.
  *
  * @param resource $message exception attachment of recurring item
  * @param array $exception_recips list of recipients
  */
 function setAllExceptionRecipients($message, $exception_recips)
 {
     $deletedRecipients = array();
     $useMessageRecipients = false;
     $recipientTable = mapi_message_getrecipienttable($message);
     $recipientRows = mapi_table_queryallrows($recipientTable, $this->recipprops);
     if (empty($recipientRows)) {
         $useMessageRecipients = true;
         $recipientTable = mapi_message_getrecipienttable($this->message);
         $recipientRows = mapi_table_queryallrows($recipientTable, $this->recipprops);
     }
     // Add organizer to meeting only if it is not organized.
     $msgprops = mapi_getprops($message, array(PR_SENT_REPRESENTING_ENTRYID, PR_SENT_REPRESENTING_EMAIL_ADDRESS, PR_SENT_REPRESENTING_NAME, PR_SENT_REPRESENTING_ADDRTYPE, $this->proptags['responsestatus']));
     if (isset($msgprops[$this->proptags['responsestatus']]) && $msgprops[$this->proptags['responsestatus']] != olResponseOrganized) {
         $this->addOrganizer($msgprops, $exception_recips);
     }
     if (!empty($exception_recips)) {
         foreach ($recipientRows as $key => $recipient) {
             $found = false;
             foreach ($exception_recips as $excep_recip) {
                 if (isset($recipient[PR_SEARCH_KEY]) && isset($excep_recip[PR_SEARCH_KEY]) && $recipient[PR_SEARCH_KEY] == $excep_recip[PR_SEARCH_KEY]) {
                     $found = true;
                 }
             }
             if (!$found) {
                 $foundInDeletedRecipients = false;
                 // Look if the $recipient is in the list of deleted recipients
                 if (!empty($deletedRecipients)) {
                     foreach ($deletedRecipients as $recip) {
                         if ($recip[PR_SEARCH_KEY] == $recipient[PR_SEARCH_KEY]) {
                             $foundInDeletedRecipients = true;
                             break;
                         }
                     }
                 }
                 // If recipient is not in list of deleted recipient, add him
                 if (!$foundInDeletedRecipients) {
                     if (!isset($recipient[PR_RECIPIENT_FLAGS]) || $recipient[PR_RECIPIENT_FLAGS] != (recipReserved | recipExceptionalDeleted | recipSendable)) {
                         $recipient[PR_RECIPIENT_FLAGS] = recipSendable | recipExceptionalDeleted;
                     } else {
                         $recipient[PR_RECIPIENT_FLAGS] = recipReserved | recipExceptionalDeleted | recipSendable;
                     }
                     $recipient[PR_RECIPIENT_TRACKSTATUS] = olRecipientTrackStatusNone;
                     // No Response required
                     $deletedRecipients[] = $recipient;
                 }
             }
             // When $message contains a non-empty recipienttable, we must delete the recipients
             // before re-adding them. However, when $message is doesn't contain any recipients,
             // we are using the recipient table of the original message ($this->message)
             // rather then $message. In that case, we don't need to remove the recipients
             // from the $message, as the recipient table is already empty, and
             // mapi_message_modifyrecipients() will throw an error.
             if ($useMessageRecipients === false) {
                 mapi_message_modifyrecipients($message, MODRECIP_REMOVE, array($recipient));
             }
         }
         $exception_recips = array_merge($exception_recips, $deletedRecipients);
     } else {
         $exception_recips = $recipientRows;
     }
     if (!empty($exception_recips)) {
         // Set the new list of recipients on the exception message, this also removes the existing recipients
         mapi_message_modifyrecipients($message, 0, $exception_recips);
     }
 }
开发者ID:EGroupware,项目名称:z-push,代码行数:76,代码来源:class.recurrence.php

示例5: addRecipients

 /**
  * Adds the recipients to an email message from a RFC822 message headers.
  *
  * @param MIMEMessageHeader $headers
  * @param MAPIMessage $mapimessage
  */
 private function addRecipients($headers, &$mapimessage)
 {
     $toaddr = $ccaddr = $bccaddr = array();
     $Mail_RFC822 = new Mail_RFC822();
     if (isset($headers["to"])) {
         $toaddr = $Mail_RFC822->parseAddressList($headers["to"]);
     }
     if (isset($headers["cc"])) {
         $ccaddr = $Mail_RFC822->parseAddressList($headers["cc"]);
     }
     if (isset($headers["bcc"])) {
         $bccaddr = $Mail_RFC822->parseAddressList($headers["bcc"]);
     }
     if (empty($toaddr)) {
         throw new StatusException(sprintf("ZarafaBackend->SendMail(): 'To' address in RFC822 message not found or unparsable. To header: '%s'", isset($headers["to"]) ? $headers["to"] : ''), SYNC_COMMONSTATUS_MESSHASNORECIP);
     }
     // Add recipients
     $recips = array();
     foreach (array(MAPI_TO => $toaddr, MAPI_CC => $ccaddr, MAPI_BCC => $bccaddr) as $type => $addrlist) {
         foreach ($addrlist as $addr) {
             $mapirecip[PR_ADDRTYPE] = "SMTP";
             $mapirecip[PR_EMAIL_ADDRESS] = $addr->mailbox . "@" . $addr->host;
             if (isset($addr->personal) && strlen($addr->personal) > 0) {
                 $mapirecip[PR_DISPLAY_NAME] = u2wi($addr->personal);
             } else {
                 $mapirecip[PR_DISPLAY_NAME] = $mapirecip[PR_EMAIL_ADDRESS];
             }
             $mapirecip[PR_RECIPIENT_TYPE] = $type;
             $mapirecip[PR_ENTRYID] = mapi_createoneoff($mapirecip[PR_DISPLAY_NAME], $mapirecip[PR_ADDRTYPE], $mapirecip[PR_EMAIL_ADDRESS]);
             array_push($recips, $mapirecip);
         }
     }
     mapi_message_modifyrecipients($mapimessage, 0, $recips);
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:40,代码来源:zarafa.php

示例6: SendMail

 function SendMail($rfc822, $forward = false, $reply = false, $parent = false)
 {
     if (WBXML_DEBUG == true) {
         debugLog("SendMail: forward: {$forward}   reply: {$reply}   parent: {$parent}\n" . $rfc822);
     }
     $mimeParams = array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8');
     $mimeObject = new Mail_mimeDecode($rfc822);
     $message = $mimeObject->decode($mimeParams);
     // Open the outbox and create the message there
     $storeprops = mapi_getprops($this->_defaultstore, array(PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID));
     if (!isset($storeprops[PR_IPM_OUTBOX_ENTRYID])) {
         debugLog("Outbox not found to create message");
         return false;
     }
     $outbox = mapi_msgstore_openentry($this->_defaultstore, $storeprops[PR_IPM_OUTBOX_ENTRYID]);
     if (!$outbox) {
         debugLog("Unable to open outbox");
         return false;
     }
     $mapimessage = mapi_folder_createmessage($outbox);
     mapi_setprops($mapimessage, array(PR_SUBJECT => u2wi(isset($message->headers["subject"]) ? $message->headers["subject"] : ""), PR_SENTMAIL_ENTRYID => $storeprops[PR_IPM_SENTMAIL_ENTRYID], PR_MESSAGE_CLASS => "IPM.Note", PR_MESSAGE_DELIVERY_TIME => time()));
     if (isset($message->headers["x-priority"])) {
         switch ($message->headers["x-priority"]) {
             case 1:
             case 2:
                 $priority = PRIO_URGENT;
                 $importance = IMPORTANCE_HIGH;
                 break;
             case 4:
             case 5:
                 $priority = PRIO_NONURGENT;
                 $importance = IMPORTANCE_LOW;
                 break;
             case 3:
             default:
                 $priority = PRIO_NORMAL;
                 $importance = IMPORTANCE_NORMAL;
                 break;
         }
         mapi_setprops($mapimessage, array(PR_IMPORTANCE => $importance, PR_PRIORITY => $priority));
     }
     $addresses = array();
     $toaddr = $ccaddr = $bccaddr = array();
     $Mail_RFC822 = new Mail_RFC822();
     if (isset($message->headers["to"])) {
         $toaddr = $Mail_RFC822->parseAddressList($message->headers["to"]);
     }
     if (isset($message->headers["cc"])) {
         $ccaddr = $Mail_RFC822->parseAddressList($message->headers["cc"]);
     }
     if (isset($message->headers["bcc"])) {
         $bccaddr = $Mail_RFC822->parseAddressList($message->headers["bcc"]);
     }
     // Add recipients
     $recips = array();
     if (isset($toaddr)) {
         foreach (array(MAPI_TO => $toaddr, MAPI_CC => $ccaddr, MAPI_BCC => $bccaddr) as $type => $addrlist) {
             foreach ($addrlist as $addr) {
                 $mapirecip[PR_ADDRTYPE] = "SMTP";
                 $mapirecip[PR_EMAIL_ADDRESS] = $addr->mailbox . "@" . $addr->host;
                 if (isset($addr->personal) && strlen($addr->personal) > 0) {
                     $mapirecip[PR_DISPLAY_NAME] = u2wi($addr->personal);
                 } else {
                     $mapirecip[PR_DISPLAY_NAME] = $mapirecip[PR_EMAIL_ADDRESS];
                 }
                 $mapirecip[PR_RECIPIENT_TYPE] = $type;
                 $mapirecip[PR_ENTRYID] = mapi_createoneoff($mapirecip[PR_DISPLAY_NAME], $mapirecip[PR_ADDRTYPE], $mapirecip[PR_EMAIL_ADDRESS]);
                 array_push($recips, $mapirecip);
             }
         }
     }
     mapi_message_modifyrecipients($mapimessage, 0, $recips);
     // Loop through message subparts.
     $body = "";
     $body_html = "";
     if ($message->ctype_primary == "multipart" && ($message->ctype_secondary == "mixed" || $message->ctype_secondary == "alternative")) {
         $mparts = $message->parts;
         for ($i = 0; $i < count($mparts); $i++) {
             $part = $mparts[$i];
             // palm pre & iPhone send forwarded messages in another subpart which are also parsed
             if ($part->ctype_primary == "multipart" && ($part->ctype_secondary == "mixed" || $part->ctype_secondary == "alternative" || $part->ctype_secondary == "related")) {
                 foreach ($part->parts as $spart) {
                     $mparts[] = $spart;
                 }
                 continue;
             }
             // standard body
             if ($part->ctype_primary == "text" && $part->ctype_secondary == "plain" && isset($part->body) && (!isset($part->disposition) || $part->disposition != "attachment")) {
                 $body .= u2wi($part->body);
                 // assume only one text body
             } elseif ($part->ctype_primary == "text" && $part->ctype_secondary == "html") {
                 $body_html .= u2wi($part->body);
             } elseif ($part->ctype_primary == "ms-tnef" || $part->ctype_secondary == "ms-tnef") {
                 $zptnef = new ZPush_tnef($this->_defaultstore);
                 $mapiprops = array();
                 $zptnef->extractProps($part->body, $mapiprops);
                 if (is_array($mapiprops) && !empty($mapiprops)) {
                     //check if it is a recurring item
                     $tnefrecurr = GetPropIDFromString($this->_defaultstore, "PT_BOOLEAN:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x5");
                     if (isset($mapiprops[$tnefrecurr])) {
//.........这里部分代码省略.........
开发者ID:nnaannoo,项目名称:paskot,代码行数:101,代码来源:ics.php

示例7: deleteAllRecipients

 /** Deletes all recipients from given message object
  *
  *@param $message MAPI message from which recipients are to be removed.
  */
 function deleteAllRecipients($message)
 {
     $recipTable = mapi_message_getrecipienttable($message);
     $recipRows = mapi_table_queryallrows($recipTable, array(PR_ROWID));
     foreach ($recipRows as $recipient) {
         mapi_message_modifyrecipients($message, MODRECIP_REMOVE, array($recipient));
     }
 }
开发者ID:alanturing1,项目名称:Z-Push-contrib,代码行数:12,代码来源:class.taskrequest.php

示例8: SendMail

 function SendMail($rfc822, $forward = false, $reply = false, $parent = false)
 {
     $mimeParams = array('decode_headers' => false, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $rfc822, 'crlf' => "\r\n", 'charset' => 'utf-8');
     $mimeObject = new Mail_mimeDecode($mimeParams['input'], $mimeParams['crlf']);
     $message = $mimeObject->decode($mimeParams);
     // Open the outbox and create the message there
     $storeprops = mapi_getprops($this->_defaultstore, array(PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID));
     if (!isset($storeprops[PR_IPM_OUTBOX_ENTRYID])) {
         debugLog("Outbox not found to create message");
         return false;
     }
     $outbox = mapi_msgstore_openentry($this->_defaultstore, $storeprops[PR_IPM_OUTBOX_ENTRYID]);
     if (!$outbox) {
         debugLog("Unable to open outbox");
         return false;
     }
     $mapimessage = mapi_folder_createmessage($outbox);
     mapi_setprops($mapimessage, array(PR_SUBJECT => u2w($mimeObject->_decodeHeader($message->headers["subject"])), PR_SENTMAIL_ENTRYID => $storeprops[PR_IPM_SENTMAIL_ENTRYID], PR_MESSAGE_CLASS => "IPM.Note", PR_MESSAGE_DELIVERY_TIME => time()));
     if (isset($message->headers["x-priority"])) {
         switch ($message->headers["x-priority"]) {
             case 1:
             case 2:
                 $priority = PRIO_URGENT;
                 $importance = IMPORTANCE_HIGH;
                 break;
             case 4:
             case 5:
                 $priority = PRIO_NONURGENT;
                 $importance = IMPORTANCE_LOW;
                 break;
             case 3:
             default:
                 $priority = PRIO_NORMAL;
                 $importance = IMPORTANCE_NORMAL;
                 break;
         }
         mapi_setprops($mapimessage, array(PR_IMPORTANCE => $importance, PR_PRIORITY => $priority));
     }
     $addresses = array();
     $toaddr = $ccaddr = $bccaddr = array();
     if (isset($message->headers["to"])) {
         $toaddr = Mail_RFC822::parseAddressList($message->headers["to"]);
     }
     if (isset($message->headers["cc"])) {
         $ccaddr = Mail_RFC822::parseAddressList($message->headers["cc"]);
     }
     if (isset($message->headers["bcc"])) {
         $bccaddr = Mail_RFC822::parseAddressList($message->headers["bcc"]);
     }
     // Add recipients
     $recips = array();
     if (isset($toaddr)) {
         foreach (array(MAPI_TO => $toaddr, MAPI_CC => $ccaddr, MAPI_BCC => $bccaddr) as $type => $addrlist) {
             foreach ($addrlist as $addr) {
                 $mapirecip[PR_ADDRTYPE] = "SMTP";
                 $mapirecip[PR_EMAIL_ADDRESS] = $addr->mailbox . "@" . $addr->host;
                 if (isset($addr->personal) && strlen($addr->personal) > 0) {
                     $mapirecip[PR_DISPLAY_NAME] = u2w($mimeObject->_decodeHeader($addr->personal));
                 } else {
                     $mapirecip[PR_DISPLAY_NAME] = $mapirecip[PR_EMAIL_ADDRESS];
                 }
                 $mapirecip[PR_RECIPIENT_TYPE] = $type;
                 $mapirecip[PR_ENTRYID] = mapi_createoneoff($mapirecip[PR_DISPLAY_NAME], $mapirecip[PR_ADDRTYPE], $mapirecip[PR_EMAIL_ADDRESS]);
                 array_push($recips, $mapirecip);
             }
         }
     }
     mapi_message_modifyrecipients($mapimessage, 0, $recips);
     // Loop through subparts. We currently only support real single-level
     // multiparts and partly multipart/related/mixed for attachments.
     // The PDA currently only does this because you are adding
     // an attachment and the type will be multipart/mixed or multipart/alternative.
     $body = "";
     if ($message->ctype_primary == "multipart" && ($message->ctype_secondary == "mixed" || $message->ctype_secondary == "alternative")) {
         foreach ($message->parts as $part) {
             if ($part->ctype_primary == "text" && $part->ctype_secondary == "plain" && isset($part->body)) {
                 // discard any other kind of text, like html
                 $body .= u2w($part->body);
                 // assume only one text body
             } elseif ($part->ctype_primary == "ms-tnef" || $part->ctype_secondary == "ms-tnef") {
                 $zptnef = new ZPush_tnef($this->_defaultstore);
                 $mapiprops = array();
                 $zptnef->extractProps($part->body, $mapiprops);
                 if (is_array($mapiprops) && !empty($mapiprops)) {
                     //check if it is a recurring item
                     $tnefrecurr = GetPropIDFromString($this->_defaultstore, "PT_BOOLEAN:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x5");
                     if (isset($mapiprops[$tnefrecurr])) {
                         $this->_handleRecurringItem($mapimessage, $mapiprops);
                     }
                     mapi_setprops($mapimessage, $mapiprops);
                 } else {
                     debugLog("TNEF: Mapi props array was empty");
                 }
             } elseif ($part->ctype_primary == "multipart" && ($part->ctype_secondary == "mixed" || $part->ctype_secondary == "related")) {
                 if (is_array($part->parts)) {
                     foreach ($part->parts as $part2) {
                         if (isset($part2->disposition) && ($part2->disposition == "inline" || $part2->disposition == "attachment")) {
                             $this->_storeAttachment($mapimessage, $part2);
                         }
                     }
//.........这里部分代码省略.........
开发者ID:jkreska,项目名称:test1,代码行数:101,代码来源:ics.php

示例9: SendMail

 function SendMail($rfc822, $smartdata = array(), $protocolversion = false)
 {
     if (WBXML_DEBUG === true && $protocolversion <= 14.0) {
         debugLog("SendMail: task " . $smartdata['task'] . " itemid: " . (isset($smartdata['itemid']) ? $smartdata['itemid'] : "") . " parent: " . (isset($smartdata['folderid']) ? $smartdata['folderid'] : "") . "\n" . $rfc822);
     }
     $mimeParams = array('decode_headers' => false, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8');
     $mimeObject = new Mail_mimeDecode($rfc822);
     $message = $mimeObject->decode($mimeParams);
     // Open the outbox and create the message there
     $storeprops = mapi_getprops($this->_defaultstore, array(PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID));
     if (!isset($storeprops[PR_IPM_OUTBOX_ENTRYID])) {
         debugLog("Outbox not found to create message");
         return false;
     }
     $outbox = mapi_msgstore_openentry($this->_defaultstore, $storeprops[PR_IPM_OUTBOX_ENTRYID]);
     if (!$outbox) {
         debugLog("Unable to open outbox");
         return false;
     }
     $mapimessage = mapi_folder_createmessage($outbox);
     mapi_setprops($mapimessage, array(PR_SUBJECT => u2w($mimeObject->_decodeHeader(isset($message->headers["subject"]) ? $message->headers["subject"] : "")), PR_SENTMAIL_ENTRYID => $storeprops[PR_IPM_SENTMAIL_ENTRYID], PR_MESSAGE_CLASS => 'IPM.Note', PR_MESSAGE_DELIVERY_TIME => time()));
     if (isset($message->headers["x-priority"])) {
         switch ($message->headers["x-priority"]) {
             case 1:
             case 2:
                 $priority = PRIO_URGENT;
                 $importance = IMPORTANCE_HIGH;
                 break;
             case 4:
             case 5:
                 $priority = PRIO_NONURGENT;
                 $importance = IMPORTANCE_LOW;
                 break;
             case 3:
             default:
                 $priority = PRIO_NORMAL;
                 $importance = IMPORTANCE_NORMAL;
                 break;
         }
         mapi_setprops($mapimessage, array(PR_IMPORTANCE => $importance, PR_PRIORITY => $priority));
     }
     $addresses = array();
     $toaddr = $ccaddr = $bccaddr = array();
     $Mail_RFC822 = new Mail_RFC822();
     if (isset($message->headers["to"])) {
         $toaddr = $Mail_RFC822->parseAddressList($message->headers["to"]);
     }
     if (isset($message->headers["cc"])) {
         $ccaddr = $Mail_RFC822->parseAddressList($message->headers["cc"]);
     }
     if (isset($message->headers["bcc"])) {
         $bccaddr = $Mail_RFC822->parseAddressList($message->headers["bcc"]);
     }
     if (count($toaddr) == 0 && count($ccaddr) == 0 && count($bccaddr) == 0) {
         debugLog("Sendmail: Message has got no recipients (no to, no cc and no bcc!)");
         return 119;
     }
     // Add recipients
     $recips = array();
     if (isset($toaddr)) {
         foreach (array(MAPI_TO => $toaddr, MAPI_CC => $ccaddr, MAPI_BCC => $bccaddr) as $type => $addrlist) {
             foreach ($addrlist as $addr) {
                 $mapirecip[PR_ADDRTYPE] = "SMTP";
                 $mapirecip[PR_EMAIL_ADDRESS] = $addr->mailbox . "@" . $addr->host;
                 if (isset($addr->personal) && strlen($addr->personal) > 0) {
                     $mapirecip[PR_DISPLAY_NAME] = u2w($mimeObject->_decodeHeader($addr->personal));
                 } else {
                     $mapirecip[PR_DISPLAY_NAME] = $mapirecip[PR_EMAIL_ADDRESS];
                 }
                 $mapirecip[PR_RECIPIENT_TYPE] = $type;
                 $mapirecip[PR_ENTRYID] = mapi_createoneoff($mapirecip[PR_DISPLAY_NAME], $mapirecip[PR_ADDRTYPE], $mapirecip[PR_EMAIL_ADDRESS]);
                 array_push($recips, $mapirecip);
             }
         }
     }
     mapi_message_modifyrecipients($mapimessage, 0, $recips);
     // Loop through message subparts.
     $body = "";
     $body_html = "";
     if ($message->ctype_primary == "multipart" && ($message->ctype_secondary == "signed" || $message->ctype_secondary == "mixed" || $message->ctype_secondary == "alternative")) {
         $mparts = $message->parts;
         for ($i = 0; $i < count($mparts); $i++) {
             $part = $mparts[$i];
             // palm pre & iPhone send forwarded messages in another subpart which are also parsed
             if ($part->ctype_primary == "multipart" && ($part->ctype_secondary == "mixed" || $part->ctype_secondary == "alternative" || $part->ctype_secondary == "related")) {
                 foreach ($part->parts as $spart) {
                     $mparts[] = $spart;
                 }
                 continue;
             }
             // standard body
             if ($part->ctype_primary == "text" && $part->ctype_secondary == "plain" && isset($part->body) && (!isset($part->disposition) || $part->disposition != "attachment")) {
                 $body .= u2w($part->body);
                 // assume only one text body
             } elseif ($part->ctype_primary == "text" && $part->ctype_secondary == "html") {
                 $body_html .= u2w($part->body);
             } elseif ($part->ctype_primary == "ms-tnef" || $part->ctype_secondary == "ms-tnef") {
                 $zptnef = new ZPush_tnef($this->_defaultstore);
                 $mapiprops = array();
                 $zptnef->extractProps($part->body, $mapiprops);
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:activesync,代码行数:101,代码来源:ics.php

示例10: SendMail

 function SendMail($rfc822, $forward = false, $reply = false, $parent = false)
 {
     $message = Mail_mimeDecode::decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $rfc822, 'crlf' => "\r\n", 'charset' => 'utf-8'));
     // Open the outbox and create the message there
     $storeprops = mapi_getprops($this->_defaultstore, array(PR_IPM_OUTBOX_ENTRYID, PR_IPM_SENTMAIL_ENTRYID));
     if (!isset($storeprops[PR_IPM_OUTBOX_ENTRYID])) {
         debugLog("Outbox not found to create message");
         return false;
     }
     $outbox = mapi_msgstore_openentry($this->_defaultstore, $storeprops[PR_IPM_OUTBOX_ENTRYID]);
     if (!$outbox) {
         debugLog("Unable to open outbox");
         return false;
     }
     $mapimessage = mapi_folder_createmessage($outbox);
     mapi_setprops($mapimessage, array(PR_SUBJECT => u2w($message->headers["subject"]), PR_SENTMAIL_ENTRYID => $storeprops[PR_IPM_SENTMAIL_ENTRYID], PR_MESSAGE_CLASS => "IPM.Note", PR_MESSAGE_DELIVERY_TIME => time()));
     if (isset($message->headers["x-priority"])) {
         switch ($message->headers["x-priority"]) {
             case 1:
             case 2:
                 $priority = PRIO_URGENT;
                 $importance = IMPORTANCE_HIGH;
                 break;
             case 4:
             case 5:
                 $priority = PRIO_NONURGENT;
                 $importance = IMPORTANCE_LOW;
                 break;
             case 3:
             default:
                 $priority = PRIO_NORMAL;
                 $importance = IMPORTANCE_NORMAL;
                 break;
         }
         mapi_setprops($mapimessage, array(PR_IMPORTANCE => $importance, PR_PRIORITY => $priority));
     }
     $addresses = array();
     $toaddr = $ccaddr = $bccaddr = array();
     if (isset($message->headers["to"])) {
         $toaddr = Mail_RFC822::parseAddressList($message->headers["to"]);
     }
     if (isset($message->headers["cc"])) {
         $ccaddr = Mail_RFC822::parseAddressList($message->headers["cc"]);
     }
     if (isset($message->headers["bcc"])) {
         $bccaddr = Mail_RFC822::parseAddressList($message->headers["bcc"]);
     }
     // Add recipients
     $recips = array();
     if (isset($toaddr)) {
         foreach (array(MAPI_TO => $toaddr, MAPI_CC => $ccaddr, MAPI_BCC => $bccaddr) as $type => $addrlist) {
             foreach ($addrlist as $addr) {
                 $mapirecip[PR_ADDRTYPE] = "SMTP";
                 $mapirecip[PR_EMAIL_ADDRESS] = $addr->mailbox . "@" . $addr->host;
                 if (isset($addr->personal) && strlen($addr->personal) > 0) {
                     $mapirecip[PR_DISPLAY_NAME] = u2w($addr->personal);
                 } else {
                     $mapirecip[PR_DISPLAY_NAME] = $mapirecip[PR_EMAIL_ADDRESS];
                 }
                 $mapirecip[PR_RECIPIENT_TYPE] = $type;
                 $mapirecip[PR_ENTRYID] = mapi_createoneoff($mapirecip[PR_DISPLAY_NAME], $mapirecip[PR_ADDRTYPE], $mapirecip[PR_EMAIL_ADDRESS]);
                 array_push($recips, $mapirecip);
             }
         }
     }
     mapi_message_modifyrecipients($mapimessage, 0, $recips);
     // Loop through subparts. We currently only support single-level
     // multiparts. The PDA currently only does this because you are adding
     // an attachment and the type will be multipart/mixed.
     if ($message->ctype_primary == "multipart" && $message->ctype_secondary == "mixed") {
         foreach ($message->parts as $part) {
             if ($part->ctype_primary == "text") {
                 $body = u2w($part->body);
             } else {
                 // attachment
                 $attach = mapi_message_createattach($mapimessage);
                 // Filename is present in both Content-Type: name=.. and in Content-Disposition: filename=
                 if (isset($part->ctype_parameters["name"])) {
                     $filename = $part->ctype_parameters["name"];
                 } else {
                     if (isset($part->d_parameters["name"])) {
                         $filename = $part->d_parameters["filename"];
                     } else {
                         $filename = "untitled";
                     }
                 }
                 // Set filename and attachment type
                 mapi_setprops($attach, array(PR_ATTACH_LONG_FILENAME => u2w($filename), PR_ATTACH_METHOD => ATTACH_BY_VALUE));
                 // Set attachment data
                 mapi_setprops($attach, array(PR_ATTACH_DATA_BIN => $part->body));
                 // Set MIME type
                 mapi_setprops($attach, array(PR_ATTACH_MIME_TAG => $part->ctype_primary . "/" . $part->ctype_secondary));
                 mapi_savechanges($attach);
             }
         }
     } else {
         $body = u2w($message->body);
     }
     if ($forward) {
         $orig = $forward;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:101,代码来源:ics.php


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