2

我真的需要帮助。我有这个功能:

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

它应该发送事件调用。它发送除描述之外的所有内容。它总是将描述字段留空。不管我送什么。我从作为描述发送的字符串中剥离<br/>,它仍然发送空白字段。标题中是否有一些我看不到的错误?有谁知道如何解决这个问题?

4

1 回答 1

1

它是:文本“提醒”之后的冒号 - 冒号是分隔元素名称和值的特殊字符,单个元素不能有多个冒号。你可以用反斜杠转义它,它应该是这样的:

DESCRIPTION:Reminder\:

可以在一个值中指定多行,方法是CRLF紧接着用 和 分隔它们。

于 2013-05-07T08:53:30.213 回答