Question

I would really need help with this. I have this function:

function sendICal($dtstart,$dtend,$loc,$summary,$from,$to,$subject, $EMAIL, $uid, $decline = 0, $debug = 0) 
{

$now=date('Ymd').'T'.date('His');
$vcal = "BEGIN:VCALENDAR\r\n";
$vcal .= "VERSION:2.0\r\n";
$vcal .= "PRODID:ITAF_IMS_NL\r\n";
$vcal .="CALSCALE:GREGORIAN\r\n";

if($debug){

$aan = ',marko.vasic@itaf.eu';
}

 else {

  for($x = 0; $x < count($EMAIL); $x++){
  $aan .= ','.$to[$x];
}
}

if($decline){

  $vcal .="METHOD:REPLY\n";
  $vcal .="BEGIN:VEVENT\n";
  $vcal .="STATUS:CONFIRMED\n";
  for($x = 0; $x < count($EMAIL); $x++){
  $vcal .= "ATTENDEE;PARTSTAT=DECLINED;CN=\"\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:".$EMAIL[$x]."\n";

  }

  $vcal .="X-WR-TIMEZONE:Europe/Brussels\n";
  $vcal .="DTSTAMP:".$now."\n";
  $vcal .="DTSTART;TZID:$dtstart\n";
  $vcal .="DTEND:".$dtend."\n";
  $vcal .="SUMMARY:Declined:".$subject."\n";
  $vcal .="SEQUENCE:1\n";
  $vcal .="X-MICROSOFT-CDO-OWNER-CRITICAL-CHANGE:$now\r\n";
  $vcal .="X-MICROSOFT-CDO-ATTENDEE-CRITICAL-CHANGE:$now\r\n";
  $vcal .="X-MICROSOFT-CDO-APPT-SEQUENCE:1\n";
  $vcal .="X-MICROSOFT-CDO-OWNERAPPTID:-1\n";
  $vcal .="X-MICROSOFT-CDO-ALLDAYEVENT:FALSE\n";
  $vcal .="END:VEVENT\n";

  } else {

  $vcal .= "METHOD:REQUEST\n";
  $vcal .= "BEGIN:VEVENT\n";
  for($x = 0; $x < count($EMAIL); $x++){
  $vcal .= "ATTENDEE;CN=\"\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:".$EMAIL[$x]."\n";

  }

  $vcal .="CREATED:".$now."\n";
  $vcal .="X-WR-TIMEZONE:Europe/Brussels\n";
  $vcal .="LAST-MODIFIED:".$now."\n";
  $vcal .= "DTSTAMP:".$now."\n";
  $vcal .= "DTSTART:".$dtstart."\n";
  $vcal .= "DTEND:".$dtend."\n";
  $vcal .= "SUMMARY:".$subject."\n";
  $vcal .= "UID:".$uid."\n";
  if ($loc != "") $vcal .= "LOCATION:".$loc."\n";
  $vcal .= "BEGIN:VALARM\n";
  $vcal .= "TRIGGER:-PT15M\n";
  $vcal .= "ACTION:DISPLAY\n";
  $vcal .= "DESCRIPTION:Reminder:".$summary."\n";
  $vcal .= "END:VALARM\n";
  $vcal .= "END:VEVENT\n";
  } 
 $vcal .= "UID:".$uid."\n";

if ($loc != "") $vcal .= "LOCATION:".$loc."\n";
      $vcal .= "END:VCALENDAR\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(substr($aan,1), $subject, $vcal, $headers);
 }

and it should send event call. It sends everything but description. It always left description field blank. No matter what I send. I strip <br/> from string that I send as description and it's still send blank field. Is there some error in headers that I don't see? Does anyone have idea how to fix this?

Was it helpful?

Solution

It's the colon : after the text "Reminder" - the colon is a special character that delimits the element name and value, you cannot have multiple colons for a single element. You can escape it with a backslash, it should look like this:

DESCRIPTION:Reminder\:

Multiple lines can be specified in a value by separating them with CRLF and a whitespace character immediately afterwards.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top