HTML in iCal attachment
Asked Answered
S

5

42

Can an iCal attachment contain HTML in the description property? If so, what are the restrictions?

Sayyid answered 12/5, 2009 at 18:2 Comment(0)
S
52

After doing some research and testing. The answer is a qualified no. Meaning: you could throw it in there, but you shouldn't.

It is not strictly forbidden by the RFC, but DESCRIPTION is not the appropriate property for HTML content.

DESCRIPTION should be the plain text version of your content. The property X-ALT-DESC with a FMTTYPE declaration of text/html is the appropriate property for HTML content.

The following example worked in both Outlook and Gmail/Google Calendar, but does not appear to be supported by Thunderbird(w/Lightning): (please, forgive the ouput. it was generated by Outlook)

X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E
    N">\n<HTML>\n<HEAD>\n<META NAME="Generator" CONTENT="MS Exchange Server ve
    rsion 08.00.0681.000">\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted f
    rom text/rtf format -->\n\n<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG
    ="en-us"><FONT FACE="Calibri">Is this in HTML?</FONT></SPAN><SPAN LANG="en
    -us"></SPAN><SPAN LANG="en-us"></SPAN></P>\n\n<P DIR=LTR><SPAN LANG="en-us
    "><FONT FACE="Calibri">Bullets:</FONT></SPAN></P>\n\n<P DIR=LTR><SPAN LANG
    ="en-us"><FONT FACE="Calibri">1.&nbsp\;&nbsp\;&nbsp\;&nbsp\;&nbsp\;</FONT>
    </SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-
    us"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"> <FONT FACE="Calib
    ri">Test 1</FONT></SPAN></P>\n\n<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="
    Calibri">2.&nbsp\;&nbsp\;&nbsp\;&nbsp\;&nbsp\;</FONT></SPAN><SPAN LANG="en
    -us"> <FONT FACE="Calibri">Test 2</FONT></SPAN><SPAN LANG="en-us"></SPAN><
    SPAN LANG="en-us"></SPAN></P>\n\n<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPA
    N LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN></P>\n\n</BODY>\n</HTML>

Like any HTML rendering in an email client supported tags and styles are limited.

Sayyid answered 13/5, 2009 at 18:7 Comment(4)
This approach doesn't work in Outlook 2003. I added some HTML in X-ALT-DESC, but OL2003 continues to show plain text description. The very same request appears perfectly fine in OL2010. Any clue?Coagulum
@Coagulum you were using outlook 2003 in 2012??Gasp
@GôTô: I'm a developer (as most of the visitors of SO) and was working on a client's project who had to distribute the solution among users who were using different versions of Outlook ranging from OL2000 to OL2010.Coagulum
In case anyone else stumbles upon my issue, here's a report of a bug in 2016 / 365: answers.microsoft.com/en-us/msoffice/forum/msoffice_outlook/…Faro
F
2

HTML in the description won't be rendered as HTML in Outlook, at the least. If you want to include rich text that Outlook will recognize, export an event from your Outlook calendar, and take a look at what they do. I believe they provide plain-text in the Description and then create another property for the HTML.

Flanna answered 12/5, 2009 at 18:27 Comment(1)
Thanks. Started w/ the Outlook generated iCal file and was able to find the appropriate fields and test w/ a few other clients.Sayyid
R
1

For anyone happening upon this page like I did and is looking to specifically have HTML content displayed for Outlook events...

As the accepted answer states, the DESCRIPTION shouldn't have any HTML. However, you can get HTML into the content of the event (at least in Outlook) using a multipart/alternative email.

MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="_CAL_B598a1969806776.58663423_B_"
To: "Your Name" <[email protected]>
From: "John Doe" <[email protected]>

--_CAL_B598a1969806776.58663423_B_
Content-Type: text/html; charset="iso - 8859 - 1"
Content-Transfer-Encoding: quoted-printable

<html><body>
<h1>Hello World</h1>
<p>This is a calendar event test</p>
</body></html>

--_CAL_B598a1969806776.58663423_B_
Content-Type: text/calendar; charset="utf - 8"; method=REQUEST
Content-Transfer-Encoding: base64

QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVRVUVTVA0KUFJPRElEOi0vL1BIUC8vTWVl
dGluZ1JlcXVlc3QvL0VODQpWRVJTSU9OOjIuMA0KQkVHSU46VkVWRU5UDQpPUkdBTkla
RVI7Q049Sm9obiBEb2U6TUFJTFRPOmpvaG4uZG9lQGV4YW1wbGUuY29tDQpBVFRFTkRF
RTtST0xFPVJFUS1QQVJUSUNJUEFOVDtQQVJUU1RBVD1ORUVEUy1BQ1RJT047UlNWUD1U
UlVFO0NOPVlvdXIgTmFtZTpNQUlMVE86eW91cm5hbWVAZXhhbXBsZS5jb20NCkRFU0NS
SVBUSU9OOkhlbGxvIFdvcmxkIEV2ZW50DQpTVU1NQVJZOkhlbGxvIFdvcmxkIEV2ZW50
DQpEVFNUQVJUOjIwMTcwODE1VDE5MDAwMFoNCkRURU5EOjIwMTcwODE1VDIwMDAwMFoN
ClVJRDowMTIzNDU2Nzg5DQpDTEFTUzpQVUJMSUMNClBSSU9SSVRZOjUNCkRUU1RBTVA6
MjAxNzA4MDhUMjAwNDU3Wg0KVFJBTlNQOk9QQVFVRQ0KU1RBVFVTOkNPTkZJUk1FRA0K
U0VRVUVOQ0U6MA0KTE9DQVRJT046MTIzIEFueSBTdHJlZXQNCkJFR0lOOlZBTEFSTQ0K
QUNUSU9OOkRJU1BMQVkNCkRFU0NSSVBUSU9OOlJFTUlOREVSDQpUUklHR0VSO1JFTEFU
RUQ9U1RBUlQ6LVBUMTVNDQpFTkQ6VkFMQVJNDQpFTkQ6VkVWRU5UDQpFTkQ6VkNBTEVO
REFS

--_CAL_B598a1969806776.58663423_B_--

In case you are wondering, that Base64 encoding translates to:

BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:-//PHP//MeetingRequest//EN
VERSION:2.0
BEGIN:VEVENT
ORGANIZER;CN=John Doe:MAILTO:[email protected]
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Your Name:MAILTO:[email protected]
DESCRIPTION:Hello World Event
SUMMARY:Hello World Event
DTSTART:20170815T190000Z
DTEND:20170815T200000Z
UID:0123456789
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20170808T200457Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
LOCATION:123 Any Street
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:REMINDER
TRIGGER;RELATED=START:-PT15M
END:VALARM
END:VEVENT
END:VCALENDAR
Renayrenckens answered 8/8, 2017 at 20:9 Comment(0)
B
1

I just saw a Google Calendar export and it seems the description is simply flagged as html. but I don't know how widely this is correctly interpreted:

X-MOZ-GOOGLE-HTML-DESCRIPTION:true
DESCRIPTION:foo<br><p>bar</p>...
Brindled answered 2/10, 2023 at 22:20 Comment(0)
N
0

I think it's possible, according to the RFC, but I doubt that it's a good idea, as it appears to be a bit of a security hole.

Nonstriated answered 12/5, 2009 at 18:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.