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
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
.