0
votes

I'm sending an event with date 20131101T130000Z and 20131101T150000Z to outlook, but the event is 10:00:00 - 12:00:00.

I tried adding the timezone in the script, but could not. The timezone is America/Fortaleza, with less than 3 hours from GMT.

And another error. It is a description that does not send to the event, and it is setted and contains information in the variable $subject

public static function enviaReuniao($dtstart,$dtend,$loc,$summary,$from,$to,$subject, $project) {
        $vcal = "BEGIN:VCALENDAR\r\n";
        $vcal .= "VERSION:2.0\r\n";
        $vcal .= "PRODID:-//Esmaltec\r\n";
        $vcal .= "METHOD:REQUEST\r\n";
        $vcal .= "BEGIN:VEVENT\r\n";
        $vcal .= "ATTENDEE;CN=\"Sistemas 3\";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:[email protected]\r\n";
        $vcal .= "ATTENDEE;CN=\"Leandro Pedrosa\";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:[email protected]\r\n";
        $vcal .= "UID:".date('Ymd').'T'.date('His')."-".rand()."-esmaltec.com.br\r\n";
        $vcal .= "DTSTAMP:".date('Ymd').'T'.date('His')."\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 .= "ORGANIZER; CN=\"EPROJ - $project\":mailto:[email protected]\n";
        $vcal .= "SEQUENCE:0\r\n";
        $vcal .= "BEGIN:VALARM\r\n";
        $vcal .= "TRIGGER:-PT15M\r\n";
        $vcal .= "ACTION:DISPLAY\r\n";
        $vcal .= "DESCRIPTION:$subject\r\n";
        $vcal .= "END:VALARM\r\n";
        $vcal .= "END:VEVENT\r\n";
        $vcal .= "END:VCALENDAR\r\n";

    //echo $vcal;
 //iso-8859-1
    $headers = "From: $from\r\nReply-To: $from"; 
    $headers .= "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; method=REQUEST; charset=\"utf-8\"";
    $headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office Outlook 12.0"; 

    if(mail($to, $summary, $vcal, $headers)) { 
        return true;
    } else { 
        return false;
    }
 }  

The example:

enviaReuniao ("20131101T130000Z", "20131101T150000Z", "Location", "Title", "[email protected]", "[email protected]", "Description", "Project 1");
1
Why couldn't you add the timezone? - John Conde

1 Answers

0
votes

If you are using the 20131101T130000Z format, all times are expressed in GMT/UTC. Given that America/Fortaleza is UTC-3h (http://www.timeanddate.com/worldclock/timezone.html?n=491), it is expected that this event should appear at 10:00. So what you see is normal.

As far as the DESCRIPTION issue, this property can appear in both VEVENT and VALARM (see http://tools.ietf.org/html/rfc5545#section-3.8.1.5). In your example,it is added only in the VALARM component (it will be used only for reminders). So you should add it in the VEVENT itself, for example right after the SUMMARY.