预约电子邮件未在Android手机PHP上显示为预约

时间:2013-12-23 20:36:27

标签: php android email appointment

怪异。在Web和Outlook中,它显示为我可以添加到我的日历中的约会;但是在手机上的Gmail应用中,它会显示为常规电子邮件(无法添加到日历中)。 这是我的功能:

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);
 }

0 个答案:

没有答案