0

Weird. On Web and in Outlook it shows as an appointment that I can add to my calendar; but on Gmail app on the phone it displays as a regular e-mail (can't add to Calendar). Here's my function:

function mail_agenda($dtstart,$dtend,$loc,$summary,$from,$to,$subject) {
  $vcal = "BEGIN:VCALENDAR\r\n";
  $vcal .= "VERSION:2.0\r\n";
  $vcal .= "PRODID:-//CompanyName//ProductName//EN\r\n";
  $vcal .= "METHOD:REQUEST\r\n";
  $vcal .= "BEGIN:VEVENT\r\n";
  // $vcal .= "ATTENDEE;CN=\"Attendee1Name\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:Att1Mail@mail.com\r\n";
  // $vcal .= "ATTENDEE;CN=\"Attendee2Name\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:Att2Mail@mail.com\r\n";
  $vcal .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-domain.com\r\n";
  $vcal .= "DTSTAMP:".date('Ymd').'T'.date('His')."\r\n";

  $vcal .= "ORGANIZER;CN=Sistema:MAILTO:john.doe@example.com\r\n";

  $vcal .= "DTSTART:$dtstart\r\n";
  $vcal .= "DTEND:$dtend\r\n"; 
  if ($loc != "") $vcal .= "LOCATION:$loc\r\n";
  $vcal .= "SUMMARY:$summary\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 = "From: $from\r\nReply-To: $from"; 
  $headers .= "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; method=REQUEST; charset=\"iso-8859-1\"";
  $headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office Outlook 12.0"; 

  mail($to, $subject, $vcal, $headers);
 }
tandelaf
  • 31
  • 3
  • 1
    Don't generate your own MIME emails. It's too easy to get it wrong. use PHPmailer or Swiftmailer instead. – Marc B Dec 23 '13 at 20:44
  • Maybe. But I'd still like an answer since it works fine on Web but not on the App on the phone. – tandelaf Dec 27 '13 at 19:36

0 Answers0