An EmailEvent can be defined with the various properties that you expect for a piece of email: From, Recipient, Subject, and Body. You can also set additional headers to be sent in the mail, and specify a list of recipients as opposed to a single recipient.

For example:

EmailEvent em = new EmailEvent ();
em.setFrom ("dynamotester");
em.setRecipient ("test@example.com");
em.setSubject ("I'm just testing the e-mail sender");
em.setBody ("Sorry to bother you, but I'm testing the e-mail sender");

The EmailEvent also includes a number of constructors that simplify the construction of typical email events:

EmailEvent em =
  new EmailEvent ("dynamotester",
                  "test@example.com",
                  "I'm just testing the e-mail sender"
                  "Sorry to bother you, but I'm testing the e-mail sender");

You can also set a list of recipients:

String [] recipients = {
  "test@example.com",
  "noone@example.com"
};
em.setRecipientList (recipients);

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices