- $headers = 'From: ' . "$from" . "\n" .
- 'Reply-To: ' . "$from" . "\n" .
- 'X-Mailer: PHP/' . phpversion() . "\n" .
- 'Content-Type: text/calendar;' . "\n" .
- 'Content-Transfer-Encoding: 7bit' . "\n";
-
- //$message = "phone: $phone date: $date time: $time";
- $message ="";
+ // Initialize our local variables
+ $boundary = "=MIME_APPOINTMENT_BOUNDARY";
+ $message = "";
+ $headers = "";
+
+ // Form the headers for the email message
+ $headers.="X-Mailer: PHP/" . phpversion() . "\n";
+ $headers.="Mime-Version: 1.0\n";
+ $headers.="Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
+ $headers.="Content-Disposition: inline\n";
+ $headers.="Reply-To: $from\n";
+ $headers.="From: $from\n";
+
+ // Print the plaintext version of the appointment
+ $message.="--$boundary\n";
+ $message.="Content-Type: text/plain; charset=us-ascii\n";
+ $message.="Content-Disposition: inline\n";
+ $message.="\n";
+ $message.="What: $description\n";
+ $message.="When: $date\n";
+ $message.="Where: $location\n";
+ $message.="\n";
+
+ // Print the .ics attachment version of the appointment
+ $message.="--$boundary\n";
+ $message.="Content-Type: text/calendar; charset=us-ascii\n";
+ $message.="Content-Disposition: attachment; filename=\"appointment.ics\"\n";
+ $message.="\n";