Java Mail API Address
by, 04-25-2012 at 10:54 PM (726 Views)
Address class is considered to be the abstract class hence class javax.mail.internet.InternetAddress will be used here.
Address address = new InternetAddress("firstname.lastname@example.org");
For name text to be displayed to Email add, one or more arguments shall be used for the name
After address has been created, make connection with message by 2 ways:Java Code:Address address = new InternetAddress(“email@example.com”, ”name”);
1: By setFrom()method: message.setFrom(address);
2: By setReplyTo()method: When want to send reply to more addresses.
Recipients could be identified when recipients are added by using addRecipient() method….Java Code:Address address = ...; Message.setReplyTo(address);
Address types are of three types:
* Message.RecipientType.TO: primary recipient
* Message.RecipientType.CC: carbon copy
* Message.RecipientType.BCC: blind carbon copy