我在 Lotus Notes 中发送会议邀请时遇到了一些问题。我正在尝试以接受/拒绝功能格式查看,但它只是作为添加到日历功能中出现。所以如果有人可以帮助我解决这个问题,那就太好了.这是我的代码
Properties props = new Properties();
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "false");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
session.setDebug(debug);
MimeMessage msg = new MimeMessage(session);
msg.addHeaderLine("method=REQUEST");
msg.addHeaderLine("charset=UTF-8");
msg.addHeaderLine("component=VEVENT");
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
if (!(recipients == null)) {
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++) {
addressTo[i] = new InternetAddress(recipients[i]);
}
log.debug("setting to recipients");
msg.setRecipients(Message.RecipientType.TO, addressTo);
}
if (!(recipientCC == null)) {
InternetAddress[] addressCC = new InternetAddress[recipientCC.length];
for (int j = 0; j < recipientCC.length; j++) {
addressCC[j] = new InternetAddress(recipientCC[j]);
}
log.debug("setting cc recipients");
msg.setRecipients(Message.RecipientType.CC, addressCC);
}
msg.setSubject(subject);
StringBuffer sb = new StringBuffer();
StringBuffer buffer = sb
.append("BEGIN:VCALENDAR\n"
+ "X-LOTUS-CHARSET:UTF-8\n"
+ "PRODID:-//Lotus Development Corporation//NONSGML Notes 8.5//EN_C\n"
+ "VERSION:2.0\n"
+ "BEGIN:VEVENT\n"
+ "CATEGORIES:Meeting\n"
+ "STATUS:NEEDS ACTION\n"
+ "DTSTART:20130727T184555\n"
+ "DTEND:20130727T194555\n"
+ "DTSTAMP:20130727T184555\n"
+ "SEQUENCE:0\n"
+ "EXPECT:IMMEDIATE\n"
+ "DESCRIPTION:Steve and John to review newest proposal material\n"
+ "SUMMARY:"
+ subject
+ "\n"
+ "CLASS:PUBLIC\n"
+ "UID:86DC83601F9625C465257BB40047FE17-Lotus_Notes_Generated\n"
+ "X-LOTUS-UPDATE-SEQ:1\n"
+ "X-LOTUS-UPDATE-WISL:$S:1;$L:1;$B:1;$R:1;$E:1;$W:1;$O:1;$M:1\n"
+ "X-LOTUS-NOTESVERSION:2\n"
+ "X-LOTUS-NOTICETYPE:I\n"
+ "X-LOTUS-APPTTYPE:3\n"
+ "X-LOTUS-CHILD-UID:86DC83601F9625C465257BB40047FE17\n"
+ "END:VEVENT\n" + "END:VCALENDAR\n");
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
// Fill the message
messageBodyPart.setHeader("Content-Class",
"urn:content-classes:calendarmessage");
messageBodyPart.setHeader("Content-ID", "calendar_message");
messageBodyPart
.setDataHandler(new DataHandler(new ByteArrayDataSource(
buffer.toString(), "text/calendar")));// very
// important
// Create a Multipart
Multipart multipart = new MimeMultipart();
// Add part one
multipart.addBodyPart(messageBodyPart);
// Put parts in message
msg.setContent(multipart);
log.debug("Sending mail");
Transport.send(msg);