I am sending mail with Java mail and an SMTP server. I want to be able to change the \"name\" that the recipient sees when they get an email message - not simply the prefix of t
Typical address syntax is of the form "user@host.domain"
or "Personal Name
.
You can use the same syntax for both FROM and TO field addresses.
Example:
Change following statement:
String[] to = {"mygmail@gmail.com","me@myservercom"};
to
String[] to = {"Recipient1 Name
You can also construct InternetAddress objects passing respective e-mailID and personal names as arguments.
Example:
String FROM = "my.email.id@my.server.domain";
InternetAddress from = new InternetAddress( FROM, "Ravinder" );
Recipient will see sender name for display as "Ravinder"
instead of "my.email.id@my.server.domain"
Reference: javax.mail.internet.InternetAddress