不显示带有ical-event的邮件正文



我正在发送一封HTML电子邮件,附带一个ical邀请。

我正面临着许多邮件客户端不能正确显示邮件正文的问题。

  • 雷鸟既不显示纯文本也不显示html电子邮件正文,只显示原始邀请
  • Outlook 2013似乎显示了html-body,但完全混乱。只显示html-mail中包含的原始文本。CSS似乎被忽略了

此问题仅在存在化学附件时发生。如果我发送相同的邮件而没有ical附件,一切都可以正常工作。

是否可能有某种标题,告诉邮件客户端除了显示邀请之外还显示邮件正文,或者我还可能错过什么?

Date: Thu, 26 Aug 2021 08:47:10 +0200 (CEST)
From: John Doe <john@doe.com>
To: Max Mustermann <max@mustermann.de>
Subject: =?UTF-8?Q?Best=C3=A4tigung_Ihres_Termins_am_18.08.2020?=
MIME-Version: 1.0
Content-Type: multipart/alternative; 
boundary="----=_Part_6_1140395501.1629960429000"
------=_Part_6_1140395501.1629960429000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<... my plain text mail ...>
------=_Part_6_1140395501.1629960429000
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<!doctype html>
<... my HTML email ...>
------=_Part_6_1140395501.1629960429000
Content-Type: text/calendar; charset=UTF-8; method=REQUEST
Content-Transfer-Encoding: 7bit
BEGIN:VCALENDAR
PRODID:-//My Company//My App//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20210826T064710Z
UID:38c15e72-12cf-44d1-97ea-a5a753f4b724
SUMMARY:Your Appointment
DESCRIPTION:Passwort: secure123nhttps://example.com/meeting
LOCATION:Online-Meeting
DTSTART;TZID=Europe/Berlin:20200818T153000
ATTENDEE;PARTSTAT=ACCEPTED;RSVP=FALSE;CN=John Doe;EMAIL=john@doe.com:mailto:john@doe.com
ATTENDEE;PARTSTAT=ACCEPTED;RSVP=FALSE;CN=Max Mustermann;EMAIL=max@mustermann.de:mailto:max@mustermann.de
END:VEVENT
END:VCALENDAR
------=_Part_6_1140395501.1629960429000--

我在从Rails发送电子附件并尝试使用MailCatcher检查结果邮件时遇到了类似的问题。

问题是Content-Transfer-Encoding: 7bit(通常用于二进制文件),但您的附件更像是纯文本。

尝试使用quoted-printable代替,如以下示例:

----==_mimepart_612e500330e6c_dd52137407244b
Content-Type: text/calendar;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename=A-1105.ics
Content-ID: <612e500337894_dd521374072738@Nielss-MBP.localdomain.mail>
BEGIN:VCALENDAR=0D
CALSCALE:GREGORIAN=0D
PRODID:-//Foxtag//DE=0D
X-WR-TIMEZONE:Europe/Amsterdam=0D
VERSION:2.0=0D
METHOD:PUBLISH=0D
BEGIN:VEVENT=0D
...

在Rails中,你可以像这样在添加附件时设置编码:

attachments['mycalendar.ics'] = {
mime_type: "text/calendar",
encoding: "quoted-printable",
content: @ical_content_as_string
}

相关内容

  • 没有找到相关文章

最新更新