如何在PHP中创建Outlook日历会议请求? [英] How to create an outlook calendar meeting request in PHP?

查看:81
本文介绍了如何在PHP中创建Outlook日历会议请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以指出我正确的方向吗?我知道这与附加.ics文件有关,但是我只能将其下载到用户可以下载然后将事件导入其Outlook日历的位置吗?如何以编程方式创建这些会议请求?

Can someone point me in the right direction? I know it has to do with attaching a .ics file, but I can only get it to the point where a user can download and then import the event into their outlook calendar? How can I programmatically create these meeting requests?

推荐答案

这里有多个参与者的有效示例:

Here is working example with multiple participants:

<?php

    $to = 'boushh@arturito.net,bobafett@arturito.net';
    $subject = "Millennium Falcon";

    $organizer          = 'Darth Vader';
    $organizer_email    = 'darthvader@arturito.net';

    $participant_name_1 = 'Boushh';
    $participant_email_1= 'boushh@arturito.net';

    $participant_name_2 = 'Boba Fett';
    $participant_email_2= 'bobafett@arturito.net';  

    $location           = "Stardestroyer-013";
    $date               = '20131026';
    $startTime          = '0800';
    $endTime            = '0900';
    $subject            = 'Millennium Falcon';
    $desc               = 'The purpose of the meeting is to discuss the capture of Millennium Falcon and its crew.';

    $headers = 'Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;\r\n';
    $headers .= "Content-Type: text/plain;charset=\"utf-8\"\r\n"; #EDIT: TYPO

    $message = "BEGIN:VCALENDAR\r\n
    VERSION:2.0\r\n
    PRODID:-//Deathstar-mailer//theforce/NONSGML v1.0//EN\r\n
    METHOD:REQUEST\r\n
    BEGIN:VEVENT\r\n
    UID:" . md5(uniqid(mt_rand(), true)) . "example.com\r\n
    DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z\r\n
    DTSTART:".$date."T".$startTime."00Z\r\n
    DTEND:".$date."T".$endTime."00Z\r\n
    SUMMARY:".$subject."\r\n
    ORGANIZER;CN=".$organizer.":mailto:".$organizer_email."\r\n
    LOCATION:".$location."\r\n
    DESCRIPTION:".$desc."\r\n
    ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN".$participant_name_1.";X-NUM-GUESTS=0:MAILTO:".$participant_email_1."\r\n
    ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN".$participant_name_2.";X-NUM-GUESTS=0:MAILTO:".$participant_email_2."\r\n
    END:VEVENT\r\n
    END:VCALENDAR\r\n";

    $headers .= $message;
    mail($to, $subject, $message, $headers);    
?>

如果您需要添加/删除选项,请参考以下VCALENDAR: 维基百科上的VCALENDAR

If you need to add/remove options here is a reference of VCALENDAR: VCALENDAR on Wikipedia

这篇关于如何在PHP中创建Outlook日历会议请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆