Sending vCalendar message from PHP
Posted: Thu Mar 06, 2008 4:48 am
Hi,
How can I send a vCalendar message from PHP so that Microsoft Outlook receives it as an appointment. I have tried using the mail() function and setting the headers as per vCalendar but I am receiving it as a normal mail rather than an appointment. Can someone look at my code and help me
- Teli
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$eol="\r";
} else {
$eol="\n";
}
$headers .= 'From: Myself <myself@gmail.com>'.$eol ;
$headers .= 'Subject: Trying' . $eol;
$headers .= 'To: You <you@yourdomain.com>' .$eol ;
$headers .= 'Mime-Version: 1.0' .$eol;
# $headers .= "Content-Type: multipart/mixed; boundary=vCalendar" .$eol;
$headers .= 'Content-Type: multipart/mixed; boundary="vCalendar"' .$eol;
$headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= '--vCalendar' .$eol;
$headers .= 'Content-Type: text/plain; charset=us-ascii' .$eol;
$headers .= 'Content-Transfer-Encoding: 7bit' .$eol;
$headers .= '--vCalendar' .$eol;
$headers .= "BEGIN:VCALENDAR".$eol;
$headers .= "VERSION:1.0".$eol;
$headers .= "BEGIN:VEVENT".$eol;
$headers .= "CATEGORIES:MEETING".$eol;
$headers .= "STATUS:TENTATIVE".$eol;
$headers .= "DTSTART:20090401T033000Z".$eol;
$headers .= "DTEND:20090401T043000Z".$eol;
$headers .= "SUMMARY:Your Proposal Review".$eol;
$headers .= "DESCRIPTION:Steve and John to review newest proposal material".$eol;
$headers .= "CLASS:PRIVATE".$eol;
$headers .= "END:VEVENT".$eol;
$headers .= "END:VCALENDAR".$eol;
$headers .= '--vCalendar' .$eol;
$headers .= 'Text/X-vCalendar Content Type' .$eol;
$msg = "" .$eol;
$msg .= "How are you " .$eol;
ini_set(sendmail_from,$fromaddress);
mail($emailaddress, $emailsubject, $msg, $headers);
How can I send a vCalendar message from PHP so that Microsoft Outlook receives it as an appointment. I have tried using the mail() function and setting the headers as per vCalendar but I am receiving it as a normal mail rather than an appointment. Can someone look at my code and help me
- Teli
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$eol="\r";
} else {
$eol="\n";
}
$headers .= 'From: Myself <myself@gmail.com>'.$eol ;
$headers .= 'Subject: Trying' . $eol;
$headers .= 'To: You <you@yourdomain.com>' .$eol ;
$headers .= 'Mime-Version: 1.0' .$eol;
# $headers .= "Content-Type: multipart/mixed; boundary=vCalendar" .$eol;
$headers .= 'Content-Type: multipart/mixed; boundary="vCalendar"' .$eol;
$headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= '--vCalendar' .$eol;
$headers .= 'Content-Type: text/plain; charset=us-ascii' .$eol;
$headers .= 'Content-Transfer-Encoding: 7bit' .$eol;
$headers .= '--vCalendar' .$eol;
$headers .= "BEGIN:VCALENDAR".$eol;
$headers .= "VERSION:1.0".$eol;
$headers .= "BEGIN:VEVENT".$eol;
$headers .= "CATEGORIES:MEETING".$eol;
$headers .= "STATUS:TENTATIVE".$eol;
$headers .= "DTSTART:20090401T033000Z".$eol;
$headers .= "DTEND:20090401T043000Z".$eol;
$headers .= "SUMMARY:Your Proposal Review".$eol;
$headers .= "DESCRIPTION:Steve and John to review newest proposal material".$eol;
$headers .= "CLASS:PRIVATE".$eol;
$headers .= "END:VEVENT".$eol;
$headers .= "END:VCALENDAR".$eol;
$headers .= '--vCalendar' .$eol;
$headers .= 'Text/X-vCalendar Content Type' .$eol;
$msg = "" .$eol;
$msg .= "How are you " .$eol;
ini_set(sendmail_from,$fromaddress);
mail($emailaddress, $emailsubject, $msg, $headers);