My email content text is
String text = "Hey, You are create a new Account! Best, MyTeam";
How can I format the text to:
Hey, You are create a new Account! Best, MyTeam
Set default format: File > Options > Compose messages in this format > HTML, Plain Text, or Rich Text. Mac: Options > Format Text switch. Outlook.com: Go to Settings > View All Outlook Settings > Mail > Compose and Reply > Compose messages in > HTML or Plain Text.
SimpleMailMessage
can only handle plain-text messages, so you need to embed explicit line-breaks in your String:
String text = "Hey,\n\nYou are create a new Account!\n\nBest, MyTeam";
A templating system such as velocity or freemarker may make this easier.
If you want to handle HTML messages, you need to use JavaMailSender
and MimeMessagePreparator
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With