3

PHPコードを使用してカレンダーリクエストメールを実装しようとしています。私のコードは次のようなものです:

$to = "srimanta.chakraborty@fugenx.com";
$subject = "Training Registration";
$message = "Thank you for participating in the Technical Certification training program.";
$location = "Conf";
//==================
$headers = "Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;";
$headers .= "Content-Type: text/plain;charset=utf-8";
$messaje = "BEGIN:VCALENDAR";
$messaje .= "VERSION:2.0";
$messaje .= "PRODID:PHP";
$messaje .= "METHOD:REQUEST";
$messaje .= "BEGIN:VEVENT";
$messaje .= "DTSTART:20121223T171010Z";
$messaje .= "DTEND:20121223T191010Z";
$messaje . "DESCRIPTION: You have registered for the class";
$messaje .= "SUMMARY:Technical Training";
$messaje .= "ORGANIZER; CN=\"Corporate\":mailto:jayashree.g@fugenx.com";
$messaje .= "Location:" . $location . "";
$messaje .= "UID:040000008200E00074C5B7101A82E00800000006FC30E6 C39DC004CA782E0C002E01A81\n";
$messaje .= "SEQUENCE:0\n";
$messaje .= "DTSTAMP:".date('Ymd').'T'.date('His')."\n";
$messaje .= "END:VEVENT\n";
$messaje .= "END:VCALENDAR\n";
$headers .= $messaje;
mail($to, $subject, $message, $headers);

このコードでメールを受け取りましたが、カレンダーのリクエスト形式に関しては受け取りませんでした。また、「Training Registration.ics」ファイルが添付されたメールが転送されました。メールと一緒に、承諾、暫定、辞退、新しい時間を提案、カレンダー オプションが必要です。その方法を教えてください。ありがとう。

4

1 に答える 1

3
$headers = 'Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;\r\n';

ここで、一重引用符を二重引用符に変更してみてください('=> ")

これは、単一引用符が\rおよび\n
参照をエスケープするためです。

更新
最後に、私は以下の提案を行い、ヘッダーを変更します。少なくとも、それは私の側で機能します。

$to = "srimanta.chakraborty@fugenx.com";
$subject = "Training Registration";
$message = "Thank you for participating in the Technical Certification training program.\r\n\r\n";
$location = "Conf";
//==================
$headers .= "MIME-version: 1.0\r\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\r\n";
$headers .= "Content-type: text/calendar; method=REQUEST; charset=UTF-8\r\n";
$messaje = "BEGIN:VCALENDAR\r\n";
$messaje .= "VERSION:2.0\r\n";
$messaje .= "PRODID:PHP\r\n";
$messaje .= "METHOD:REQUEST\r\n";
$messaje .= "BEGIN:VEVENT\r\n";
$messaje .= "DTSTART:20121223T171010Z\r\n";
$messaje .= "DTEND:20121223T191010Z\r\n";
$messaje .= "DESCRIPTION: You have registered for the class\r\n";
$messaje .= "SUMMARY:Technical Training\r\n";
$messaje .= "ORGANIZER; CN=\"Corporate\":mailto:jayashree.g@fugenx.com\r\n";
$messaje .= "Location:" . $location . "\r\n";
$messaje .= "UID:040000008200E00074C5B7101A82E00800000006FC30E6 C39DC004CA782E0C002E01A81\r\n";
$messaje .= "SEQUENCE:0\r\n";
$messaje .= "DTSTAMP:".date('Ymd').'T'.date('His')."\r\n";
$messaje .= "END:VEVENT\r\n";
$messaje .= "END:VCALENDAR\r\n";
$message .= $messaje;
mail($to, $subject, $message, $headers);
于 2012-12-28T07:15:48.133 に答える