Hi all,
my boss want me to send an calendar invitation event to Microsoft Outlook
i have tried many time already and it still give me the result
"This is no a valid internet calendar file"
and here my code:
$vcal = "BEGIN:VCALENDAR";
$vcal .= "VERSION:2.0";
$vcal .= "PRODID:-//CompanyName//ProductName//EN";
$vcal .= "METHOD:REQUEST";
$vcal .= "BEGIN:VEVENT";
$vcal .= "ATTENDEE;CN=\"Attendee1Name\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:Att1Mail@mail.com";
$vcal .= "ATTENDEE;CN=\"Attendee2Name\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:Att2Mail@mail.com";
$vcal .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-example.com.my";
$vcal .= "DTSTAMP:".date('Ymd').'T'.date('His');
$vcal .= "DTSTART:09/06/2011";
$vcal .= "DTEND:10/06/2011";
$vcal .= "LOCATION:Meeting room 2";
$vcal .= "SUMMARY:hahaha....meeting";
$vcal .= "BEGIN:VALARM";
$vcal .= "TRIGGER:-PT15M";
$vcal .= "ACTION:DISPLAY";
$vcal .= "DESCRIPTION:Reminder";
$vcal .= "END:VALARM";
$vcal .= "END:VEVENT";
$vcal .= "END:VCALENDAR";
$headers .= "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; method=REQUEST; charset=\"iso-8859-1\"";
$headers = "From: nybuler\r\nReply-To: nybuler.ong@besta.com.my";
$headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office Outlook 12.0";
//Create the Transport
$transport = Swift_SmtpTransport::newInstance('mail.example.com.my',25)
->setUsername('php.mailer@example.com.my')
->setPassword('abc123456');
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
//Create a message
$message = Swift_Message::newInstance('Meeting Invite Testing')
->setFrom(array('php.mailer@example.com.my'))
->setTo(array('example@example.com.my'))
//->setTo($to_mail)
//->setCc($cc_mail)
//->setBcc($bcc_mail)
->addPart($vcal,'text/calendar');
//Send the message
$result = $mailer->send($message);
you can see from here i'm using swift mailer! any one know how to solve my problem?
i'm appreciate for any help!
PS: the email will be send out with an calendar invitation as attachment.
and my problem is i can't open the attachment! God!