i am trying to send icalendar to the users, so that they can open these ics files in outlook and save the appointment. mailer i am using is 'phpmailer.php'.
problem is that it sends ical format as html in message body. Here is my code
$text="
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
CATEGORIES:MEETING
STATUS:TENTATIVE
DTSTART:".$startDateTime."
DTEND:".$endDateTime."
SUMMARY:Interview for the candidate".$cname."
DESCRIPTION:".$message."
CLASS:PRIVATE
END:VEVENT
END:VCALENDAR";
$mail->SetFrom('xxxxxx@yahoo.com', 'xxxx');
$mail->IsSMTP();
$mail->Host = "smtp.mail.yahoo.com";
$mail->SMTPAuth = true;
$mail->Username = 'xxxxxxxx@yahoo.com';
$mail->Password = 'xxxxx';
$mail->AddAddress($addresses[$i]);
$mail->Subject = "Interview schedule of Candidate";
$headers = "From: Sender
";
$headers .= "Reply-To: xxxxxx@yahoo.com
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/calendar; method=REQUEST; charset=utf-8
";
$headers .= "Content-Transfer-Encoding: 8bit
";
$headers .= "Content-class: urn:content-classes:calendarmessage
";
$mail->Body=$body;
if(!$mail->Send($headers,$body))
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}
Please let me know what is wrong with my code. Thanks in advance