How to create an outlook calendar meeting request in PHP?(如何在 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;
';
$headers .= "Content-Type: text/plain;charset="utf-8"
"; #EDIT: TYPO
$message = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Deathstar-mailer//theforce/NONSGML v1.0//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:" . md5(uniqid(mt_rand(), true)) . "example.com
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART:".$date."T".$startTime."00Z
DTEND:".$date."T".$endTime."00Z
SUMMARY:".$subject."
ORGANIZER;CN=".$organizer.":mailto:".$organizer_email."
LOCATION:".$location."
DESCRIPTION:".$desc."
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN".$participant_name_1.";X-NUM-GUESTS=0:MAILTO:".$participant_email_1."
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN".$participant_name_2.";X-NUM-GUESTS=0:MAILTO:".$participant_email_2."
END:VEVENT
END:VCALENDAR
";
$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 日历会议请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 PHP 中创建 Outlook 日历会议请求?
基础教程推荐
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- HTTP 与 FTP 上传 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- PHP 守护进程/worker 环境 2022-01-01