Hello,
When I schedule a meeting with Outlook and send out invitations, the invitations appear as calender items in the inbox of Outlook users. When they open it, they can accept, decline, etc.
I'm trying write a PHP script that sends a vCalendar item by e-mail and have Outlook interpret it in the same way as an Outlook invitation. I have come as far as below, and the e-mail should contain only the vCalendar. But it appears in my inbox as a regular e-mail with attachment.
Does anyone know what I'm doing wrong? Here's a snippet of my script:
$uid = md5(rand());
$vCalendar = "BEGIN:VCALENDAR\r\n";
$vCalendar.= "VERSION:1.0\r\n";
$vCalendar.= "BEGIN:VEVENT\r\n";
$vCalendar.= "ATTENDEE;ROLE=ATTENDEE;RSVP=YES;EXPECT=REQUIRE:";
$vCalendar.= $email."\r\n";
$vCalendar.= "ORGANIZER:MAILTO:".$organiserEmail."\r\n";
$vCalendar.= "SUMMARY:".$meeting['title']."\r\n";
$vCalendar.= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:";
$vCalendar.= .$meeting['objective']."\r\n";
$vCalendar.= "DTSTART:".date( "Ymd\THis\Z", $meeting['startTime'] )."\r\n";
$vCalendar.= "DTEND:".date( "Ymd\THis\Z", $meeting['endTime'] )."\r\n";
$vCalendar.= "DTSTAMP:".date( "Ymd\THis\Z", time() )."\r\n";
$vCalendar.= "UID:".$uid."\r\n";
$vCalendar.= "END:VEVENT\r\n";
$vCalendar.= "END:VCALENDAR\r\n";
$subject = "invitation";
$headers = "From: $organiserEmail\r\n";
$headers.= "MIME-Version: 1.0\r\n";
$main_boundary = "----=_NextPart_".md5(rand());
$headers.= "Content-Type: text/x-vCalendar; charset=\"utf-8\"\r\n";
$headers.= "Content-Disposition: inline; filename=\"invitation.vcs\"\r\n";
$headers.= "Content-Transfer-Encoding: base64\r\n\r\n";
$headers.= chunk_split( base64_encode( $vCalendar ) );
$res = mail( $email, $subject, "", $headers );
I'd appreciate any help on this.
Regards,
S. Kruger