错误
我也遇到了这个问题,最终将ics文件作为代码点火器中的附件发送:
希望这有所帮助。
我正在使用ical_library
生成会议邀请,它正在生成一个代码:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Sabre//Sabre VObject 4.1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:sabre-vobject-4b0105a1-bac5-4068-bd65-b4581d3497c4
DTSTAMP:20160602T081647Z
SUMMARY:Training Schedule Invitation
DTSTART:2016-06-03 09:00:00
DTEND:2016-06-03 10:00:00
LOCATION:Bangalore
ATTENDEE:ragesh@ascent-online.net
END:VEVENT
END:VCALENDAR
但是当我将此代码作为邮件内容发送时,它不会转换为邀请。
将显示相同的代码。我正在使用codeigniter
电子邮件库来发送电子邮件。
private function sendCalEntry( $tsStart, $tsEnd, $location, $summary, $title, $resources, $to, $subject ){
$from = ORGANISATIONREPLYMAIL;
$dtstart = date('Ymd',$tsStart).'T'.date('His',$tsStart);
$dtend = date('Ymd',$tsEnd).'T'.date('His',$tsEnd);
$loc = $location;
$vcal = "BEGIN:VCALENDARrn";
$vcal .= "VERSION:2.0rn";
$vcal .= "PRODID:-//nonstatics.com//OrgCalendarWebTool//ENrn";
$vcal .= "METHOD:REQUESTrn";
$vcal .= "BEGIN:VEVENTrn";
$vcal .= "ORGANIZER;CN="".ORGANISATIONNAME." (".$_SESSION['username'].")"."":mailto:".ORGANISATIONREPLYMAIL."rn";
$vcal .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-nonstatics.comrn";
$vcal .= "DTSTAMP:".date('Ymd').'T'.date('His')."rn";
$vcal .= "DTSTART:$dtstartrn";
$vcal .= "DTEND:$dtendrn";
$vcal .= "LOCATION:$locationrn";
$vcal .= "SUMMARY:$summaryrn";
$vcal .= "DESCRIPTION:Hinweis/Fahrer:$summary - Folgende Resourcen wurden gebucht: $resources rn";
$vcal .= "BEGIN:VALARMrn";
$vcal .= "TRIGGER:-PT15Mrn";
$vcal .= "ACTION:DISPLAYrn";
$vcal .= "DESCRIPTION:Reminderrn";
$vcal .= "END:VALARMrn";
$vcal .= "END:VEVENTrn";
$vcal .= "END:VCALENDARrn";
$headers = "From: $fromrnReply-To: $from";
$headers .= "rnMIME-version: 1.0rnContent-Type: text/calendar; name=calendar.ics; method=REQUEST; charset="iso-8859-1"";
$headers .= "rnContent-Transfer-Encoding: 7bitrnX-Mailer: Microsoft Office Outlook 12.0";
return @mail($to, $subject . " " . $summary . " / " . $resources, $vcal, $headers);
}
http://blog.sebastian-martens.de/2012/01/submit-outlook-calendar-invitations-with-php/
当我在线验证 ICS 数据时,它返回以下错误:
错误
无效的 DTSTART 值,必须是行 # 5 附近的日期或日期时间值
参考:RFC 5545 3.3.5。日期-时间
无效的 DTEND 值,必须是行 # 5 附近的日期或日期时间值
参考:RFC 5545 3.3.5。日期-时间
我的解决方案
我也遇到了这个问题,最终将ics文件作为代码点火器中的附件发送:
$this->email->attach($ics_data_as_string, 'attachment', $name_for_ics_file_in_email, 'text/calendar');
希望这有所帮助。