是否可以将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
Example
现在,它仅显示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中找到了解决方案:
以正确的方式使用MultiPart解决了问题
标签:outlook-2007,outlook,icalendar,java,vcalendar
来源: https://codeday.me/bug/20191023/1914790.html