Java mail outlook appointment issue

P

Pedro Pinto

Hi there to everyone!

I've been reseaching this topic. So far, the best efford for the
operation is:

Can send an e-mail with an outlook meeting request,
User receives e-mail with an attachment file, meeting.ics,
User can open and accept meeting and organizer receives read report
and acceptance,
User and Organizer cannot see the attendees of the meeting.

The issue, has described, is that the invitation is sent well but when
openning with Microsoft Outlook only the meeting organizer appears!
Does anyone knows how to solve this issue?

Thanks in advance.

Bellow goes the code.

-------------------------------

public class Mail {

/** Creates a new instance of Mail */
public Mail() {
}


public static void main(String[] args){

try{


MimetypesFileTypeMap mimetypes =
(MimetypesFileTypeMap)MimetypesFileTypeMap.getDefaultFileTypeMap();
mimetypes.addMimeTypes("text/calendar ics ICS");

MailcapCommandMap mailcap =
(MailcapCommandMap)MailcapCommandMap.getDefaultCommandMap();
mailcap.addMailcap("text/calendar;; x-java-content-
handler=com.sun.mail.handlers.text_plain");

//Calendar calendar = builder.build(fin);

String host = "xxx"; //Outbound mail address
String from = "(e-mail address removed)";
String to = "(e-mail address removed)";

// Get system properties
Properties props = System.getProperties();

// Setup mail server
props.put("mail.smtp.host", host);

// Get session
Session session = Session.getInstance(props, null);

// Define message
MimeMessage message = new MimeMessage(session);
message.addHeaderLine("method=REQUEST");
message.addHeaderLine("charset=UTF-8");
message.addHeaderLine("component=vevent");

message.setFrom(new InternetAddress(from));
//message.addRecipient(Message.RecipientType.TO, new
InternetAddress(to));
message.addRecipient(Message.RecipientType.TO, new
InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new
InternetAddress("(e-mail address removed)"));
message.setSubject("Outlook Meeting Request Using
JavaMail");

StringBuffer sb = new StringBuffer();


StringBuffer buffer = sb.append("BEGIN:VCALENDAR\n" +
"PRODID:-//Microsoft Corporation//Outlook 11.0
MIMEDIR//EN\n" +
"VERSION:2.0\n" +
"METHOD:REQUEST\n" +
"BEGIN:VEVENT\n" +
"ATTENDEE;CN=\"xxx\";ROLE=REQ-
PARTICIPANT;RSVP=TRUE:MAILTO:[email protected]\n"+
"ATTENDEE;CN=\"xxx\";ROLE=REQ-
PARTICIPANT;RSVP=TRUE:MAILTO:[email protected]\n"+
"ORGANIZER:MAILTO:[email protected]\n" +
"DTSTART:20071120T193000Z\n" +
"DTEND:20071120T200000Z\n" +
"LOCATION:Conference room\n" +
"TRANSP:OPAQUE\n" +
"SEQUENCE:0\n" +
"UID:
040000008200E00074C5B7101A82E00800000000002FF467CE3AC5010000000000000000100\n"
+
" 000004377FE5C37984842BF9440448399EB02\n" +
"DTSTAMP:20071120T120102Z\n" +
"DESCRIPTION:This the description of the meeting.
\n" +
"SUMMARY:Test meeting request\n" +
"PRIORITY:5\n" +
"X-MICROSOFT-CDO-IMPORTANCE:1\n"+
"CLASS:pUBLIC\n" +
"BEGIN:VALARM\n" +
"TRIGGER:pT15M\n" +
"ACTION:DISPLAY\n" +
"DESCRIPTION:Reminder\n" +
"END:VALARM\n" +
"END:VEVENT\n" +
"END:VCALENDAR");

// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
System.out.println(sb);
// Fill the message
messageBodyPart.setText("You are requested to participlate
in the review meeting.");

// Create a Multipart
Multipart multipart = new MimeMultipart();

// Add part one
multipart.addBodyPart(messageBodyPart);

// Part two is attachment
// Create second body part
messageBodyPart = new MimeBodyPart();
String filename = "invitation.ics";
messageBodyPart.setFileName(filename);
messageBodyPart.setHeader("Content-Class", "urn:content-
classes:calendarmessage");
messageBodyPart.setHeader("Content-
ID","calendar_message");
messageBodyPart.setContent(buffer.toString(), "text/
calendar");

// Add part two
multipart.addBodyPart(messageBodyPart);

// Put parts in message
message.setContent(multipart);

// send message
Transport.send(message);
} catch (MessagingException me) {
me.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}




}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top