3

Is there a possibility to add html to a description from a vevent.

I generate a VCALENDAR with a VEVENT with a description. I use Ical4j to sent the email with ICS

This is what I try to do:

BEGIN:VCALENDAR
PRODID:-//----//Calendar 1.0//ES
VERSION:2.0
METHOD:REQUEST
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20101202T145512Z
UID:20101202T145513Z-project@myPc
DESCRIPTION:ALTREP="CID:content-id-here":BlaBla
LOCATION:Room 2
SUMMARY:Confirmation
DTSTART:20110115T180000
DTEND:20110115T184500
ATTENDEE;ROLE=REQ-PARTICIPANT:mailto:foo@bar.com
ORGANIZER;SENT-BY=EyeContact:mailto:foo@bar.com
END:VEVENT
END:VCALENDAR

Content-Type:text/html
Content-Id:content-id-here

   <html>
     <head>
      <title></title>
     </head>
     <body>
       <p>
         <b>Example</b>
       </p>
     </body>
   </html>

Now it simply show the HTML code.

The above calendar I put in a MultiPart

message.addHeaderLine("method=REQUEST");
message.addHeaderLine("charset=UTF-8");
message.addHeaderLine("component=vevent");
message.setFrom(new InternetAddress(fromAddress));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(app.getPanelist().getEmail()));
message.setSubject(subject);
Multipart mp = new MimeMultipart();
MimeBodyPart iCalAttachment = new MimeBodyPart();
iCalAttachment.setDataHandler(new DataHandler(new ByteArrayDataSource(new ByteArrayInputStream(invite), "text/calendar;method=REQUEST;charset=\"UTF-8\"")));
mp.addBodyPart(iCalAttachment);
message.setContent(mp);

Do I miss a part or is impossible?

EDIT - What I try to do with iCal4j (using Altrep)

ParameterList params = new ParameterList();     
URI uri = new URI("CID:content-id-here");
params.add(new AltRep(uri));
vEvent.getProperties().add(new Description(params,_content));

But with the code from above I'am stuck. Somebody a idea to use HTML in combination with iCall4j

matt b
  • 138,234
  • 66
  • 282
  • 345
Michel
  • 9,220
  • 13
  • 44
  • 59

2 Answers2

3

I found the solution in this blogspot:

http://valermicle.blogspot.com/2009/02/i-was-searching-for-documentations-on.html

Using a MultiPart on the correct manner solved the problem

Michel
  • 9,220
  • 13
  • 44
  • 59
2

Looking at the iCalendar specifications, it looks like you need an "Alternate Text Representation" See RFC 5545 Section 3.2.1

Example:

   DESCRIPTION;ALTREP="CID:part3.msg.970415T083000@example.com":
    Project XYZ Review Meeting will include the following agenda
     items: (a) Market Overview\, (b) Finances\, (c) Project Man
    agement

The "ALTREP" property parameter value might point to a "text/html" content portion.

   Content-Type:text/html
   Content-Id:<part3.msg.970415T083000@example.com>

   <html>
     <head>
      <title></title>
     </head>
     <body>
       <p>
         <b>Project XYZ Review Meeting</b> will include
         the following agenda items:
         <ol>
           <li>Market Overview</li>
           <li>Finances</li>
           <li>Project Management</li>
         </ol>
       </p>
     </body>
   </html>
Community
  • 1
  • 1
mcrumley
  • 5,682
  • 3
  • 25
  • 33
  • mm I need to look into this, but is seems that is must reference to a other content part of your email... I get an error like: '.URISyntaxException: Illegal character in scheme name at index 0:

    '...

    – Michel Dec 02 '10 at 15:58
  • after escaping: same error: .URISyntaxException: Illegal character in scheme name at index 0: <p> – Michel Dec 02 '10 at 16:06
  • Where is the exception being thrown? What are you setting the URI to? – mcrumley Dec 02 '10 at 21:38