最近,我的组织从Rackspace上的托管Exchange迁移到了Office365。
我有一个工作脚本来发送用php编写的事件,以便在Outlook 2010中可以接受或拒绝这些事件。但是迁移似乎打破了脚本。在活动中,我现在看到一个电子邮件正文,其中包含我的iCalender详细信息,如下所示:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-fgdfg
METHOD:REQUEST
BEGIN:VEVENT
UID:abc
DTSTAMP:20150909T052235Z
DTSTART:20150908T040000Z
DTEND:20150908T060000Z
SUMMARY:abc
ORGANIZER;CN=name:mailto:namne@xx.com
DESCRIPTION:abc
LOCATION:asdasd
END:VEVENT
END:VCALENDAR
创建活动和发送电子邮件的代码如下:
$desc = 'abc';
$start = '20150908T0400';
$end = '20150908T0600';
$location = 'asdasd';
$message = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-fgdfg
METHOD:REQUEST
BEGIN:VEVENT
UID:".$desc."
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART:".$start."00Z
DTEND:".$end."00Z
SUMMARY:".$desc."
ORGANIZER;CN=".$organizer.":mailto:".$organizer_email."
DESCRIPTION:".$desc."
LOCATION:".$location."
END:VEVENT
END:VCALENDAR";
$headers .= $message;
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->CharSet = "utf8";
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = "smtp.office365.com";
$mail->Port = xx;
$mail->IsHTML(false);
$mail->Username = "name@xx.com";
$mail->Password = "pwd";
$mail->SetFrom("$organizer_email");
$mail->AddAddress($to,"xx");
$mail->Subject = "$desc";
$mail->Body = "$message";
$mail->AddCustomHeader($headers);
if(!$mail->Send())//Send mail
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "\n".$desc." message has been sent";
}
Office365邮件唯一改变的是服务器名称,端口号和ssl到tls。
任何帮助都得到了认可。