简体   繁体   中英

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!

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

// or this way with an InternetAddress
message.setFrom(new InternetAddress("john@example.com", "John Smith"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM