I am trying to send html as email from JavaMailSender
. The html
has an <img>
tag.
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage,true);
mimeMessageHelper.setTo("preetham.kv@highpeaksw.com");
mimeMessageHelper.setText("<img src=cid:netLogo\" />",true);
ClassPathResource netLogoImg = new ClassPathResource("sample.png");
mimeMessageHelper.addInline("netLogo",netLogoImg);
mailSender.send(mimeMessage);
But when the email is sent, the image is going as an attachment rather than the image of the email content. How to send html's with image and link from spring-boot
?