user620339
user620339

Reputation: 901

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!

Upvotes: 4

Views: 4993

Answers (1)

Jamie McCrindle
Jamie McCrindle

Reputation: 9214

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"));

Upvotes: 11

Related Questions