How to send a email meeting notification through java.

Hi Experts,

Is it possible to send Meeting Invites to email recipients, using Lotus Notes like mail client. The invite needs to be generated completely from within out java web application code.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This has instructions for what you're looking for:
bcisystemsAuthor Commented:

No i am actullay looking for email where in you would go and accept a meeting. So I should be able to send a calendar meeting request.


Frankly, already don't remember the details, but this code worked
for me for several years, sending invitations in the morning
about event at 2:00 pm every Mon-Thurs; recipients used  Outlook 2003

It was rather painful, and still not fully satisfied me in a sense
of reminders to recipients.

Still, if nothing  "more official" and format independent showed up by now, and if your
users are using Outlook, maybe you want to look at this code and format of the invitation in it

I guess RandomArray class is not necerssary - I wanted to randomize order of recipients each day

import java.util.Properties;
import java.util.Date;
import java.util.Vector;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import java.text.SimpleDateFormat;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;

public class Email
public Email()

* @param args
public static void main(String[] args)
Email email = new Email();
catch (Exception e)


public void send() throws Exception {

try {

String from = "";
String to = "";
    Vector idStrings = new Vector();
    Vector emails = new Vector();

    Class.forName ("oracle.jdbc.driver.OracleDriver");
      Connection conn =
                    DriverManager.getConnection ("connection_string",
           "user", "password");

    Statement stmt = conn.createStatement();

    ResultSet rs = stmt.executeQuery("select flag, email, id_string from dinner_emails");

      String  flag = rs.getString(1);

   if(emails.size() < 1) {
       System.out.println("No one to send invite to");

    int [] orderArray;

    orderArray = RandomArray.getRandomArray(emails.size());

       InternetAddress [] intAdds;
    String [] attStrings;
    attStrings = new String[emails.size()];
    intAdds = new InternetAddress[emails.size()];
    String attString = "";

    for(int jj=0; jj<emails.size(); jj++){
        intAdds[jj] = new InternetAddress((String)emails.elementAt(orderArray[jj]));
        attString +=
       "ATTENDEE;CN=\"" +(String)idStrings.elementAt(orderArray[jj]) + "\";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:"+
               (String)emails.elementAt(orderArray[jj]) + "\n";


Properties prop = new Properties();

    java.util.Date now = new java.util.Date();

    SimpleDateFormat ff = new SimpleDateFormat("yyyyMMdd");

    String today = ff.format(now);
    int year = now.getYear();
    int day = now.getDate();
    int month = now.getMonth();

prop.put("", "");

Session session = Session.getDefaultInstance(prop, null);
// Define message
MimeMessage message = new MimeMessage(session);

message.setFrom(new InternetAddress(from));
message.addRecipients(Message.RecipientType.TO, intAdds);
message.setSubject("Dinner ordering");

StringBuffer sb = new StringBuffer();

StringBuffer buffer = sb.append("BEGIN:VCALENDAR\n" +
"PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN\n" +
"VERSION:2.0\n" +
attString +
"\n" +
"DTSTART:" + today +"T210000Z\n" +
"DTEND:" + today + "T210500Z\n" +
"SEQUENCE:0\n" +
"UID:040000008200E00074C5B7101A82E00800000000002FF466CE3AC5010000000000000000100\n" +
" 000004377FE5C37984842BF9440448399EB02\n" +
"DTSTAMP:" + today + "T120102Z\n" +
"CATEGORIES:Meeting\n" +
"SUMMARY:Dinner ordering\n" +
"PRIORITY:5\n" +
"DESCRIPTION:Reminder\n" +

// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();

// Fill the message
messageBodyPart.setHeader("Content-Class", "urn:content-classes:calendarmessage");
messageBodyPart.setContent(buffer.toString(), "text/calendar");

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

// Add part one

// Put parts in message

// send message
} catch (MessagingException me) {
} catch (Exception ex) {

Open in new window

public class RandomArray {

    public static int [] getRandomArray(int n){
        int [] numbers;
        numbers = new int[n];

        for(int jj=0; jj<n; jj++){
            numbers[jj] = -1;
    //    System.out.println(numbers[1]);

        double part = 1.0/n;

        for(int jj=0; jj<100000000; jj++){
            boolean good = false;
            for(int ii=0; ii<n; ii++){
                if(numbers[ii] == -1)good = true;

            double r = Math.random();

            int num = (int) (r/part);

            boolean keep = true;
            for(int ii=0; ii<n; ii++){
                if(numbers[ii] == num)keep = false;

             for(int ii=0; ii<n; ii++){
                if(numbers[ii] == -1){numbers[ii] = num;
                 break; }



        return numbers;


    public static void main(String [] args){
         int [] numbers;
        numbers = getRandomArray(1);
        for (int jj=0; jj<1; jj++)System.out.println(numbers[jj]);


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.