[英]HTML in iCal using iCal4j
是否有可能将html添加到vevent的描述中。
我生成一个带有描述的VEVENT
的VCALENDAR
。 我使用Ical4j发送带有ICS
的电子邮件
这就是我尝试做的事情:
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>
现在它只显示HTML代码。
上面的日历我放在一个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);
我会错过一部分还是不可能?
编辑 - 我尝试用iCal4j做什么(使用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));
但是由于上面的代码我被困住了。 有人建议将HTML与iCall4j结合使用
我在这个blogspot中找到了解决方案:
http://valermicle.blogspot.com/2009/02/i-was-searching-for-documentations-on.html
以正确的方式使用MultiPart解决了这个问题
查看iCalendar规范,看起来您需要“备用文本表示”,请参阅RFC 5545第3.2.1节
例:
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
“ALTREP”属性参数值可能指向“text / html”内容部分。
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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.