Outlook无法识别ics消息 [英] Outlook fails to recognize an ics message

查看:346
本文介绍了Outlook无法识别ics消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用PHP创建一个.ics文件,并邮寄给用户。该解决方案在Gmail中效果很好(我收到了一封精美的邀请,所有信息都出现在正确的位置),但是Outlook似乎一点都无法识别它。据我所知,我收到的电子邮件没有附件,没有日历,也没有事件添加到任何日历。

I am trying to create an .ics file in PHP that is mailed to the user. The solution works well in Gmail (I get a fancy invitation with all information appearing in the right places), but Outlook does not seem to recognize it at all. I receive an empty email with no attachment and no event is added to any calendar as far as I can see.

我怀疑问题出在标题中,但是我很少有邮件协议方面的经验,无法查明。我整天都在摆弄,请帮忙:(

I suspect the problem lies somewhere in the headers, but I have very little experience with mail protocols and can't pinpoint it. I've been fiddling with this all day, please help :(

更新:由于某些奇怪的原因,我确实收到了邀请,并且在同步的iPhone上显示为附件

Update: for some weird reason I do get the invite and it shows as attachment on iPhone which is synced with my Exchange account. It is the desktop Outlook that fails. Why?

这是所有荣耀中的代码。

Here is the code in all it's glory.

$message = 
"BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP: $timestamp
DTSTART: $datestart
DTEND: $dateend
UID: $uniqueid
LOCATION: $address
DESCRIPTION: $description
URL;VALUE=URI: $uri
SUMMARY: $summary

END:VEVENT
END:VCALENDAR";

// Mail parameters
$newline = "\r\n";

$headers = "From: InnovationskontorEtt Dashboard <admin@innovationskontorett.se>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/calendar; charset=utf-8; name=inbjudan.ics; method=REQUEST".$newline; 
$headers .= "Content-Disposition: inline; filename=inbjudan.ics".$newline;
$headers .= "Content-Transfer-Encoding: 7bit";

$subject = $summary;

$to = 'maija.vilkina@liu.se';

/*mail send*/
if(mail($to, $subject, $message, $headers)) : ?>
      <div class="alert alert-warning">
        Evenemanget skickades till din kalender.
      </div>

<?php else : ?>
      <div class="alert alert-danger">
        Det gick inte att skicka evenemanget till din kalender.
      </div>
<?php endif; ?>


推荐答案

最好的做法是至少发送多部分/替代形式,以便对文本/日历格式一无所知的客户端可以向用户显示可读消息。请参见 http://tools.ietf.org/html/rfc6047#section-4.2 为例。

In general, it is a best practice to at least send a multipart/alternative so that clients that dont know anything about the text/calendar format can show a readable message to the user. See http://tools.ietf.org/html/rfc6047#section-4.2 for an example.

然后,进行激励要成为实际邀请,它必须至少具有一个ORGANIZER和一个ATTENDEE属性。请参阅 http://tools.ietf.org/search/rfc5546#section-3.2。 2 获取必填属性列表。

Then, for an invitation to be an actual invitation it needs to have at least one ORGANIZER and one ATTENDEE property. See http://tools.ietf.org/search/rfc5546#section-3.2.2 for the list of mandatory properties. This should fix your issue.

最后,向我们展示实际发送的MIME消息比显示代码更有用,至少在检测Outlook互操作问题方面

Finally, showing us the actual MIME message that is sent would be more useful than showing code, at least as far as detecting interop issues with Outlook.

这篇关于Outlook无法识别ics消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆