I am trying send calendar meeting invite using java mail. But am facing below error. i have searched on stack overflow. All answers with related error are for mail.
no object DCH for MIME type text/calendar;method=REQUEST
code :
BodyPart calendarPart = new MimeBodyPart();
calendarPart.addHeader("Content-Class", "urn:content-classes:calendarmessage");
calendarPart.setContent(calendarContent, "text/calendar;method=REQUEST");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(calendarPart);
MimeMessage message = new MimeMessage(session);
message.addHeaderLine("method=REQUEST");
message.addHeaderLine("charset=UTF-8");
message.addHeaderLine("component=VEVENT");
message.setSubject(meetingSubject);
message.setContent(multipart);
Transport.send(message);
Error Trace:
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar;method=REQUEST
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:885)
at javax.activation.DataHandler.writeTo(DataHandler.java:316)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1485)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:865)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:462)
at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:103)
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:883)
at javax.activation.DataHandler.writeTo(DataHandler.java:316)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1485)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1773)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1121)
The issue got resolved. Update Mail to 1.4.7. Also, there were some issues on the server-side related to the Amazon SES service.