我如何发送包括.ics文件PHP

时间:2015-12-15 09:25:13

标签: php outlook appointment

代码的目标是生成Outlook预约并发送给人们。目前我有一个能够生成.ics文件的代码。

    <?php

$startTime ='12-15-2015';
$endTime='12-15-2015';
$subject='Test';
$ical = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
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."
DESCRIPTION:".$desc."
END:VEVENT
END:VCALENDAR";

  //set correct content-type-header
  header('Content-type: text/calendar; charset=utf-8');
  header('Content-Disposition: inline; filename=calendar.ics');
  echo $ical;
  exit;
?>

当触发此代码时,.ics文件将下载到用户计算机。用户需要手动点击.ics文件,然后会弹出outlook。 我可以拥有一些东西,当我触发代码时,Outlook会自动打开那些开始和结束日期吗?

谢谢

0 个答案:

没有答案
相关问题