I am trying to send the mail using JavaMailSender which include the html content but instead of the rendered html in the email i am getting the html code itself in the mail i.e
Method used to send email
public void sendMimeMessage(String from, String to, String subject, String messageBody, String... cc) {
MimeMessage message = mailSender.createMimeMessage()
try {
MimeMessageHelper helper = new MimeMessageHelper(message, true);
helper.setFrom(from)
helper.setSentDate(new Date())
helper.setSubject(subject)
helper.setText(messageBody, true)
helper.setTo(to)
helper.setCc(cc)
mailSender.send(message)
log.debug("Email successfully sent to <${to}> with cc <${cc}> and with subject <${subject}> and Email body: ${messageBody}")
} catch (Exception exception) {
exception.printStackTrace()
log.error("Email to <${to}> with subject <${subject}> could not be sent due to: ", exception)
}
}
Any help would be appreciated.