JavaMail - Send plain HTML content without formatting
0
I want to send an email using JavaMail with HTML tags not formatted. I use this code : public void sendMail() throws MessagingException, IllegalStateException, IllegalArgumentException { Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", "localhost"); Session session = Session.getDefaultInstance(properties); MimeMessage message = new MimeMessage(session); MimeMultipart multipart = new MimeMultipart(); MimeBodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setContent("<h1>This is an HTML message</h1>", "text/plain; charset=UTF-8"); multipart.addBodyPart(messageBodyPart); message.setContent(multipart); message.setFrom(new InternetAddress("noreply@l...