I am using Quarkus Mailer and Quarkus Template to create an endpoint that will be responsible just for sending emails. For now it just receives the subject, body and the emails that the email should be sent to. I am using Quarkus Template so that I have a base html template for all emails. However I want to be able to pass html through the endpoint so that I am able to render different styles in the content of the template.
This is the part of the template where the body is rendered:
<tr style='mso-yfti-irow:5;height:343.95pt'>
<td width=621 valign=top style='width:466.05pt;border-top:none;border-left: solid #0E133C 2.25pt;border-bottom:none;border-right:solid #0E133C 2.25pt; padding:2.0cm 1.0cm 1.0cm 1.0cm;height:343.95pt'>
<p class=MsoNormal><span lang=PT style='mso-ansi-language:PT'>{sendEmailRequest.getBody()}<o:p></o:p></span></p>
</td>
</tr>
Basically the "sendEmailRequest.getBody()" has the html content and it is currently being rendered like this:
This is the code used to send the email:
public void sendEmail(final SendEmailRequest sendEmailRequest) {
final String html = template.data("sendEmailRequest", sendEmailRequest).render();
mailer.send((new Mail()).setSubject(sendEmailRequest.getSubject())
.setHtml(html)
.setTo(sendEmailRequest.getTos()));
}
Keep in mind that I want to keep using a base template for the email and not directly use the body received from the DTO as the whole email body. I already managed to use html from the endpoint, but that was wihtout using the template.