Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show only from "name" not email address in JavaMailSender and client Outlook

I am using spring MimeMessageHelper and JavaMailSender. Is it possible to show only the message senders name and not the address when sending email , email client (Outlook).

Thanks!

like image 497
user620339 Avatar asked Dec 21 '22 03:12

user620339


1 Answers

MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true, "UTF-8");
// you can either do it this way with a regular string
message.setFrom("John Smith <[email protected]>");

// or this way with an InternetAddress
message.setFrom(new InternetAddress("[email protected]", "John Smith"));
like image 156
Jamie McCrindle Avatar answered May 24 '23 17:05

Jamie McCrindle