I am using php to send an ICS calendar invite using this great function:
function sendIcalEmail($firstname,$lastname,$email,$meeting_date,$meeting_name,$meeting_duration,$address,$details) {
$from_name = "Jason";
$from_address = "[email protected]";
$subject = "Showing"; //Doubles as email subject and meeting subject in calendar
$meeting_description = $details;
$meeting_location = $address; //Where will your meeting take place
$message='';
//Convert MYSQL datetime and construct iCal start, end and issue dates
$meetingstamp = STRTOTIME($meeting_date . " UTC");
$dtstart= GMDATE("Ymd\THis\Z",$meetingstamp);
$dtend= GMDATE("Ymd\THis\Z",$meetingstamp+$meeting_duration);
$todaystamp = GMDATE("Ymd\THis\Z");
echo 'start:'.$dtstart.'<br><br>';
echo 'end:'.$dtend.'<br><br>';
//Create unique identifier
$cal_uid = DATE('Ymd').'T'.DATE('His')."-".RAND()."@mydomain.com";
//Create Mime Boundry
$mime_boundary = "----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>Dear '.$firstname.' '.$lastname.',</p>';
//$message .= '<p>Here is my HTML Email / Used for Meeting Description</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:PUBLISH
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;name="meeting.ics";method=REQUEST\n';
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= $ical;
//SEND MAIL
$mail_sent = @MAIL( $email, $subject, $message, $headers );
IF($mail_sent) {
RETURN TRUE;
} ELSE {
RETURN FALSE;
}
}
On my phone I see the following as the date/time:
Thursday Oct 9, 2014
from 08:00 to 09:00
from 12:00 to 13:00 (GMT)
where my to and from arguments are the following:
start:20141009T120000Z
end:20141009T130000Z
So to me the 08:00 and 09:00 are unexpected. But maybe I am missing something.
What is your timezone? Your program, probably, shows the original time in UTC/GMT (letter Z - Zulu in timestamp) and adds time in your timezone. 12:00 - 13:00 UTC is the same as 8:00 - 9:00 am ET with daylight. Setup the correct timezone in your start and end times.