gpt4 book ai didi

email - 使用 iCal 发送电子邮件到带有 valarm 提醒的 Outlook

转载 作者:行者123 更新时间:2023-12-04 12:51:54 24 4
gpt4 key购买 nike

我想将带有 iCal 附件的电子邮件发送到 Outlook 日历,我想将提醒设置为开始事件前 120 分钟。

我用 iCal 发送 RAW 消息(见下文)。
如果收件人打开邮件,事件会自动添加到 Outlook 日历,但提醒设置为 15 分钟(Outlook 中的默认值),即使我在 VALARM 中设置了不同的值。

如果我使用 iCal 的 ics 文件导入到 Outlook 日历,则提醒设置为我的值。

我真的很感激这方面的帮助。如何设置事件提醒?

    $from_name = "<FROM_NAME>";
$from_address = "<FROM_ADDRESS>";
$subject = "Meeting Booking";
$meeting_description = "Here is a brief description of my meeting\n\n";
$meeting_location = "My Office";
$domain = 'domain.com';

$to_name = "<TO_NAME>";
$to_address = "<TO_ADDRESS>";
$meeting_date = "2015-10-21 15:40:00";
$meeting_duration = 3600;

$meeting_stamp = STRTOTIME($meeting_date . " UTC");
$dtstart= GMDATE("Ymd\THis\Z",$meeting_stamp);
$dtend= GMDATE("Ymd\THis\Z",$meeting_stamp+$meeting_duration);

$mime_boundary = "----Meeting Booking----".MD5(TIME());

//Create ICAL Content
$ical = 'BEGIN:VCALENDAR' . "\r\n" .
'PRODID:-//Patient Portal//MyEyeDr.//EN' . "\r\n" .
'VERSION:2.0' . "\r\n" .
'METHOD:REQUEST' . "\r\n" .
'BEGIN:VEVENT' . "\r\n" .
'ORGANIZER;CN="'.$from_name.'":MAILTO:'.$from_address. "\r\n" .
'ATTENDEE;CN="'.$to_name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$to_address. "\r\n" .
'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" .
'UID:'.date("Ymd\TGis", strtotime($meeting_date)).rand()."@".$domain."\r\n" .
'DTSTAMP:'.date("Ymd\TGis"). "\r\n" .
'DTSTART;TZID="America/New_York":'.$dtstart. "\r\n" .
'DTEND;TZID="EAmerica/New_York":'.$dtend. "\r\n" .
'SEQUENCE:1'. "\r\n" .
'SUMMARY:' . $subject . "\r\n" .
'LOCATION:' . $meeting_location . "\r\n" .
'CLASS:PUBLIC'. "\r\n" .
'PRIORITY:5'. "\r\n" .
'BEGIN:VALARM'. "\r\n" .
'ACTION:Display'. "\r\n" .
'DESCRIPTION:'.$meeting_description. "\r\n" .
'SUMMARY:Event Alarm'. "\r\n" .
'TRIGGER:-PT120M'. "\r\n" .
'END:VALARM'. "\r\n" .
'END:VEVENT'. "\r\n" .
'END:VCALENDAR'. "\r\n";

$message= "To: ".$to_address."\n";
$message.= "From: ".$from_address."\n";
$message.= "Subject: Example SES mail (raw)\n";
$message.= "MIME-Version: 1.0\n";
$message .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
$message .= "Content-class: urn:content-classes:calendarmessage\n";
$message.= "\n\n";
$message .= "--$mime_boundary\r\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body>\n";
$message .= '<p>Dear ...,</p>';
$message .= '<p>This is an email message.</p>';
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--$mime_boundary\r\n";
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST'."\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "X-Mailer: Microsoft Office Outlook 15.0\r\n";
$message .= $ical;

最佳答案

我认为您的代码没有任何问题。大多数日历客户端将忽略与邀请一起发送的任何警报。仔细想想,这是有道理的:如果你邀请我,我可能想接受或拒绝,但你不应该决定什么时候我想得到通知。

另一方面,在导入时,您将这些事件设为您自己的。

关于email - 使用 iCal 发送电子邮件到带有 valarm 提醒的 Outlook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33256584/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com