HTML in iCal attachment

前端 未结 4 1589
走了就别回头了
走了就别回头了 2020-12-13 00:21

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

相关标签:
4条回答
  • 2020-12-13 00:43

    For anyone happening upon this page like I did and is looking to specifically have HTML content displayed for Outlook events, this can be done with the e-mail being multipart/alternative, e.g.

    MIME-Version: 1.0
    Content-Type: multipart/alternative; boundary="_CAL_B598a1969806776.58663423_B_"
    To: "Your Name" <yourname@example.com>
    From: "John Doe" <john.doe@example.com>
    
    --_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:john.doe@example.com
    ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Your Name:MAILTO:yourname@example.com
    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
    
    0 讨论(0)
  • 2020-12-13 00:45

    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.

    0 讨论(0)
  • 2020-12-13 00:54

    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.

    0 讨论(0)
  • 2020-12-13 00:55

    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.

    0 讨论(0)
提交回复
热议问题