Im building something that awkwardly resembles Facebook, to use as an intranet... and as such, the system allows you to organise meetings. In my attempt to make this thing useful, I thought it would be cool to email everyone thats invited to the meeting an 'Outlook meeting Request', which I now discover can be an iCal/vCal formatted email...

So far, Ive had limited success, despite reading many posts which largely claim its a piece of cake...

$body = '';
$body .= "BEGIN:VCALENDAR\n";
					$body .= "PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN\n";
					$body .= "VERSION:2.0\n";
					$body .= "METHOD:REQUEST\n";
					$body .= "BEGIN:VEVENT\n";
					$body .= "ORGANIZER:MAILTO:Administrator@exchange.org\n";
					$body .= "DTSTART:" . date('Ymd',$meeting['start_mktime']) . date('His',$meeting['start_mktime']) . "\n"; 
					$body .= "DTEND:20060306T053000Z\n";
					$body .= "LOCATION:location\n";
					$body .= "TRANSP:OPAQUE\n";
					$body .= "SEQUENCE:0\n";
					$body .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-offacebook.com\n"; // required by Outlok
					$body .= "DTSTAMP:".date('Ymd').'T'.date('His')."\n"; // required by Outlook
					$body .= "DESCRIPTION: " . $meeting['blurb'] . "\n";
					$body .= "SUMMARY:" . $meeting['title'] . "\n";
					$body .= "PRIORITY:5\n";
					//$body .= "X-MICROSOFT-CDO-IMPORTANCE:1\n";
					$body .= "CLASS:PUBLIC\n";
					$body .= "END:VEVENT\n";
					$body .= "END:VCALENDAR\n";

What Ive done is create this vCal template, which I fill in with some of my own variables... the $body is then put into my email function as the body of a plain-text email... this all works great, and the email arrives and it is plain-text, as far as I can tell, if I 'view source' all I see is text, no HTML tags...


BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:MAILTO:Administrator@exchange.org
DTSTART:20100526174500
DTEND:20060306T053000Z
LOCATION:location
TRANSP:OPAQUE
SEQUENCE:0
UID:20100525T154531-1991560951-offacebook.com
DTSTAMP:20100525T154531
DESCRIPTION: This is the description
SUMMARY:CheckUp
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR


Can anyone help?

As far as I can tell the best you're going to be able to do is link to the php file that creates a vcal event. Your email script would read something more like:

$body = '';
$body .= "<a href=\"http://example.com/vcalgenerator.php?organizer=Administrator@exchange.org&start=" . date('Ymd',$meeting['start_mktime']) . date('His',$meeting['start_mktime']) . "\">Download a Calendar File</a>";

and then vcalgenerator.php would look something like this:

<?php
    $Filename = "Event1234567.vcs";
    header("Content-Type: text/x-vCalendar");
    header("Content-Disposition: inline; filename=$Filename");
?>
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:MAILTO:<?php $_GET['organizer'] ?>
ETCETERA
ETCETERA
ETCETERA
ETCETERA
ETCETERA
ETCETERA
ETCETERA
PRIORITY:5
//"X-MICROSOFT-CDO-IMPORTANCE:1
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR

I hope that helps I don't feel that eloquent at the moment so it might not be the best worded thing on the planet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.