How do I include a text name with the from header, besides just an email address?

John Zukowski

The message.setFrom(new InternetAddress(from)); line is suffcient to include a name with the line, where from would be a string like ""Bill Clinton" <president@whitehouse.gov>". You can also use the constructor public InternetAddress(java.lang.String address, java.lang.String personal) that allows you to pass the address and personal information separately. Or, you can even call the setPersonal() method to directly set the information on an existing InternetAddress.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact