我写了一个发送会议请求的小程序。我正在使用 SwiftMailer 发送电子邮件。
当电子邮件到达目的地时,当收件人单击接受/拒绝时,它不会发回通知。我相信标题信息是正确的,电子邮件的内容也是正确的:
<?PHP
$message = "<html>\n";
$message .= "<body>\n";
$message .= '<p>Dear '.$emailto_name.',</p>';
$message .= '<p><br>'.$meeting_description.'<br></p>';
$message .= '<p>Thanks,<br>CATS</p>';
$message .= "</body>\n";
$message .= "</html>\n";
$cal[] = "BEGIN:VCALENDAR";
$cal[] = "PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN";
$cal[] = "VERSION:2.0";
$cal[] = "METHOD:REQUEST";
$cal[] = "BEGIN:VTIMEZONE";
$cal[] = "TZID:" . $tz_name . "";
$cal[] = "BEGIN:STANDARD";
$cal[] = "DTSTART:".date('Ymd')."T".date('His')."";
$cal[] = "TZOFFSETFROM:" . $tzOffsetFrom . "";
$cal[] = "TZOFFSETTO:". $tzOffsetTo . "";
$cal[] = "RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11";
$cal[] = "END:STANDARD";
$cal[] = "BEGIN:DAYLIGHT";
$cal[] = "DTSTART:". date('Ymd') . "T" . date('His') . "";
$cal[] = "TZOFFSETFROM:". $tzOffsetTo . "";
$cal[] = "TZOFFSETTO:" . $tzOffsetFrom . "";
$cal[] = "RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3";
$cal[] = "END:DAYLIGHT";
$cal[] = "END:VTIMEZONE";
$cal[] = "BEGIN:VEVENT";
$cal[] = "DTSTART;TZID=".$meeting_start;
$cal[] = "DTEND;TZID=".$meeting_end;
$cal[] = "ORGANIZER:MAILTO:".$from_address;
$cal[] = "ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;X-NUM-GUESTS=0:MAILTO:".$from_address;
$cal[] = "LOCATION:".$meeting_location;
$cal[] = "TRANSP:OPAQUE";
$cal[] = "SEQUENCE:0";
$cal[] = "UID:".$cal_uid;
$cal[] = "DTSTAMP:".$todaystamp;
$cal[] = "DESCRIPTION:".$meeting_description;
$cal[] = "SUMMARY:".$subject;
$cal[] = "PRIORITY:5";
$cal[] = "CLASS:PUBLIC";
$cal[] = "END:VEVENT";
$cal[] = "END:VCALENDAR";
$cal_str = implode("\r\n", $cal);
$the_message = Swift_Message::newInstance()
->setSubject('Interview Schedule')
->setFrom($emailfrom)
->setSender($emailfrom)
->setTo($emailto)
->setBody($message, 'text/html')
->addPart($cal_str, 'text/calendar');
$headers = $the_message->getHeaders();
$headers->AddTextHeader('Content-class', 'urn:content-classes:calendarmessage');
$headers->AddTextHeader('Disposition-Notification-To', '"' . $_SESSION['CATS']->getEmail() . '" <' . $_SESSION['CATS']->getEmail() . '>' );
$result = $mailer->send($the_message);
if ($result === 1)
echo "\tEmail was sent successfully.</p>";
else
echo "\tCould not send the message ($result).</p>";
?>
谁能告诉我没有发送接受/拒绝通知是我做错了什么。
谢谢一堆。