Outlook fails to recognize an ics message(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 上显示为附件,与我的 Exchange 帐户同步.失败的是桌面 Outlook.为什么?
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?
这是所有荣耀的代码.
$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 = "
";
$headers = "From: InnovationskontorEtt Dashboard <admin@innovationskontorett.se>
";
$headers .= "MIME-Version: 1.0
";
$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; ?>
推荐答案
一般来说,最好的做法是至少发送一个 multipart/alternative 以便对文本/日历格式一无所知的客户端可以显示一个可读的给用户的消息.请参阅 https://www.rfc-editor.org/rfc/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 https://www.rfc-editor.org/rfc/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 邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Outlook 无法识别 ics 邮件
基础教程推荐
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01