Java mail outlook appointment issue

  • Follow


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 = "xxx@xxx.com";
            String to = "xxx@xxx.com";

            // 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("xxx.xxx@xxx.xxx"));
            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:xxx.xxx.xxx@sitel.pt\n"+
                    "ATTENDEE;CN=\"xxx\";ROLE=REQ-
PARTICIPANT;RSVP=TRUE:MAILTO:xxx.xxx@xxx.xxx\n"+
                    "ORGANIZER:MAILTO:xxx.xxx.xxx@xxx.xxx\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();
        }




    }

}
0
Reply kubic62 (34) 11/20/2007 1:25:49 PM


0 Replies
41 Views

(page loaded in 0.12 seconds)

Similiar Articles:













7/23/2012 6:54:21 AM


Reply: