View RSS Feed

Java Mail

Java Mail API Address

Rate this Entry
by , 04-25-2012 at 09:54 PM (919 Views)
Address class is considered to be the abstract class hence class javax.mail.internet.InternetAddress will be used here.

Address address = new InternetAddress("name@site.net");

For name text to be displayed to Email add, one or more arguments shall be used for the name

Java Code:
Address address = new InternetAddress(“name@site.net”, ”name”);
After address has been created, make connection with message by 2 ways:

1: By setFrom()method: message.setFrom(address);
2: By setReplyTo()method: When want to send reply to more addresses.

Java Code:
Address address[] = ...;
Message.setReplyTo(address[]);
Recipients could be identified when recipients are added by using addRecipient() method….

message.addRecipient(type, address);
Address types are of three types:
* Message.RecipientType.TO: primary recipient
* Message.RecipientType.CC: carbon copy
* Message.RecipientType.BCC: blind carbon copy

Submit "Java Mail API Address" to Facebook Submit "Java Mail API Address" to Digg Submit "Java Mail API Address" to del.icio.us Submit "Java Mail API Address" to StumbleUpon Submit "Java Mail API Address" to Google

Categories
Mail API

Comments