14

Hi im using cakephp email to send an email with .ics calendar attached to it the problem is that the confirmation button si shown in yahoo and gmail prefectly but not in outlook.com. here's an example of an .ics file:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//T//T//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:20150830T184133-19847-domain.com
DTSTAMP:20150830T184133
DTSTART:20150812T000000Z
DTEND:20150818T000000Z
ORGANIZER;CN=myteam:MAILTO:admin@myteam.org
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=brabrick@hotmail.com:MAILTO:brabrick@hotmail.com
LOCATION:new york
SUMMARY:Madrid
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR

here's my php code that's creating the appointement .ics file:

                $vcal = "BEGIN:VCALENDAR\r\n";
                $vcal .= "VERSION:2.0\r\n";
                $vcal .= "PRODID:-//T//T//EN\r\n";
                $vcal .= "METHOD:REQUEST\r\n";
                $vcal .= "BEGIN:VEVENT\r\n";


                $vcal .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-domain.com\r\n";
                $vcal .= "DTSTAMP:".date('Ymd').'T'.date('His')."\r\n";
                $vcal .= "DTSTART:$visitedate\r\n";
                $vcal .= "DTEND:$visitedate\r\n";             
                $vcal       .=  "ORGANIZER;CN=myteam:MAILTO:admin@myteam.org\r\n";//j'ai ajouté cette ligne
                $vcal       .= "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=$mail[$iduser]:MAILTO:$mail[$iduser]\r\n";
                //$vcal .= "DTEND:$end\r\n";
                if ($loc != "") $vcal .= "LOCATION:$loc\r\n";
                $vcal .= "SUMMARY:$objet\r\n";
                $vcal .= "BEGIN:VALARM\r\n";
                $vcal .= "TRIGGER:-PT15M\r\n";
                $vcal .= "ACTION:DISPLAY\r\n";
                $vcal .= "DESCRIPTION:Reminder\r\n";
                $vcal .= "END:VALARM\r\n";
                $vcal .= "END:VEVENT\r\n";
                $vcal .= "END:VCALENDAR\r\n";


                $headers = "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; method=REQUEST; charset=\"iso-8859-1\"";
                $headers .= "\r\nContent-Disposition: attachment; filename=\"appointment.ics\"";
                $headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office Outlook 12.0";


                $Email = new CakeEmail('smtp');
                $Email->to($mail);
                $Email->subject($objet);
                $Email->replyTo('admin@myteam.org');
                $Email->from ('admin@myteam.org');
                $Email->setHeaders(array($headers));

thanks in advance

user1655410
  • 371
  • 8
  • 26

1 Answers1

3

Your ics file looks fine so the issue is most likely related to your email MIME structure. Have a look at Multipart email with text and calendar: Outlook doesn't recognize ics

Community
  • 1
  • 1
Arnaud Quillaud
  • 4,420
  • 1
  • 12
  • 8
  • the .ics is recognized it shows it as file to download it like a normale file with .ics extension, so i think it's a problem in vcalendar?? – user1655410 Sep 08 '15 at 14:55
  • No. Please have a look at the other post. Clients are very sensitive to how your email message is structured (MIME content-types). – Arnaud Quillaud Sep 11 '15 at 09:15
  • oki just one question, should the outlook.com be configured to show the vcalendar, because it happened to me in gmail i have to sync it with google agenda before to show icalendar in the email?? – user1655410 Sep 12 '15 at 20:38
  • You mean to say that your outlook.com calendar account shall be linked to your outlook.com mail account ? I think this is by default in outlook.com – Arnaud Quillaud Sep 13 '15 at 10:05