我正在尝试通过我的PHP代码发送日历请求邮件。我收到了邮件和日历。但是我在开始日期有问题。如何根据海湾标准时间配置开始日期。现在我按照格林尼治标准时间得到了,尽管我没有提到任何地方。这意味着简而言之,如果我将在早上7点发送请求,那么在开始日期它将显示上午11点。 我的代码就像:
$dtstart = $start_date_conf;
$dtend=$end_date_conf;
$todaystamp = date("Ymd\THis\Z");
//Create unique identifier
$cal_uid = date('Ymd').'T'.date('His')."-".rand()."@fugenx.com";
//Create Mime Boundry
$mime_boundary = "----Bespot Meeting Booking----".md5(time());
//Create Email Headers
$headers = "From: ".$from_name." <".$from_address.">\n";
$headers .= "Reply-To: ".$from_name." <".$from_address.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\n";
//Create Email Body (HTML)
$message .= "--$mime_boundary\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>'.$messagess.'</p>';
$message .= '<p></p><p></p>';
$message .= '<p><b>Thanks & Regards,:</b></p>';
$message .= '<p>'.$full_name.'</p>';
$message .= '<p>'.$full_address.'</p>';
$message .= '<p>'.$email_address.'</p>';
$message .= '<p>'.$mobile_number.'</p>';
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--$mime_boundary\n";
//Create ICAL Content (Google rfc 2445 for details and examples of usage)
$ical = "BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:MAILTO:".$from_address."
DTSTART:".$dtstart."
DTEND:".$dtend."
LOCATION:".$meeting_location."
TRANSP:OPAQUE
SEQUENCE:0
UID:".$cal_uid."
DTSTAMP:".$todaystamp."
DESCRIPTION:".$meeting_description."
SUMMARY:".$subject."
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR";
$message .= "Content-Type: text/calendar;method=REQUEST;charset=utf-8\n";
//$message .= "Content-Type: text/calendar;name=\"meeting.ics\";method=REQUEST\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= $ical;
//SEND MAIL
$mail_sent = @mail( $email, $subject, $message, $headers );
答案 0 :(得分:0)
参见RFC5545,您需要添加一个vtimezone组件来将TZID引用到它
参数名称:TZID
必须在“DTSTART”上指定此参数, a时,“DTEND”,“DUE”,“EXDATE”和“RDATE”属性 指定DATE-TIME或TIME值类型,值为 无论是UTC还是“浮动”时间。 未能在iCalendar对象中包含和遵循VTIMEZONE定义可能会导致对当地时间的不一致理解 在任何给定的位置。
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
METHOD:REQUEST
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Asia/Qatar
BEGIN:STANDARD
DTSTART:20081102T090000
TZOFFSETFROM:+0300
TZOFFSETTO:+0300
TZNAME:CST
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
ORGANIZER:MAILTO:mailto@organiser.net
DTSTART;TZID=Asia/Qatar:20130104T090000
DTEND;TZID=Asia/Qatar:20130104T100000
LOCATION:meeting_location
TRANSP:OPAQUE
SEQUENCE:0
UID:cal_uid
DTSTAMP:20130104T224617Z
DESCRIPTION:meeting_description
SUMMARY:subject
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR