I wish to format my messages sent from my API to look a bit more proper. I'm wondering what the best practice for this is?
EmailController, this is where i send my messages.
@PostMapping("/send")
public void sendEmail(@RequestBody Contact contact) throws Exception {
SimpleMailMessage mailMessage = new SimpleMailMessage();
mailMessage.setTo("test@gmail.com");
mailMessage.setSubject(contact.getSubject());
mailMessage.setText("Email: " + contact.getEmail() +
contact.getMessage());
try {
emailSenderService.sendEmail(mailMessage);
} catch (MailException ex) {
System.err.println(ex.getMessage());
}
}
The format looks quite ugly, is there any way i can make the text bold and add linebreakers etc ? any suggestions are much appreciated.