'Sending multi-part email sends HTML part as attachement
I'm using micronaut and I want to send template e-mails.
But when I send e-mail the HTML part of the email is sent as attachement.
I use SMTP office 365 server for outgoing e-mails.
I have this piece of code and I tried different SMTP servers and also recievers.
fun sendMail(email: EmailData): EmailException? {
try {
emailSender.send(
Email.builder()
.from(email.from)
.to(email.to)
.subject(email.subject)
.body(
MultipartBody(
TemplateBody(BodyType.HTML, ModelAndView("email/purchase-created-html", email.variables)),
TemplateBody(BodyType.TEXT, ModelAndView("email/purchase-created-text", email.variables))
)
)
)
return null
} catch (exception: EmailException) {
return exception
}
}
Do you know why is the HTML part sent as html attachement? The content-type of e-mail is multipart
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
