Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Hi All,
I am using com.day.cq.mailer.MailService to send email and noticed that whenever I use HTML template it always enclose the template content "pre" tag. My concern is that since it enclose the HTML content into "pre" tag, all my CSS styling is does not reflect because of this. Is there any solution to change this behavior?
My template contains
From: ${fromEmail} Subject: ${subject} <div> <br/> Hi ${toName},<br/> <br/> Your account has been created. To activate your account, please click the following link:<br/><br/> <a href="${link}" >${link}</a><br/><br> Thank You,<br/> ${fromName}<br/> </div>
And the resulting email when it sent
<html><body><pre><div> <br/> Hi homervillanueva,<br/> <br/> Your account has been created. To activate your account, please click the following link:<br/><br/> <a href="http://localhost/register/activate.html?token=24912749237492374" >http://localhost/register/activate.html?token=24912749237492374</a><br/><br> Thank You,<br/> Operation Team<br/> </div></pre></body></html>
Appreciate for any input and advice.
Thanks!
¡Resuelto! Ir a solución.
Vistas
Respuestas
Total de me gusta
OOB HtmlEMailTemplate just replace the variables and does not append any elements. Seems like issue at other layer. Verify in the node where template is stored <pre> element exists? If so then look at component may be rte or some custom transformer adding it.
Vistas
Respuestas
Total de me gusta
OOB HtmlEMailTemplate just replace the variables and does not append any elements. Seems like issue at other layer. Verify in the node where template is stored <pre> element exists? If so then look at component may be rte or some custom transformer adding it.
Vistas
Respuestas
Total de me gusta
Hi Sham HC,
The HTML content which I posted above is the actual content of the HTML template i created, nothing more - nothing less. But when the email is sent the whole content of the template is enclosed inside pre, body and html tag. I have no idea where these added tags came from as they were not existing in my template.
Thanks!
Vistas
Respuestas
Total de me gusta
Hi,
Is this solved? I am having the same issue right now but I couldn't find the solution or any possible place inserting the <pre> tag.
Thanks.
Vistas
Respuestas
Total de me gusta
can you paste the code snippet with which you send mail?
Vistas
Respuestas
Total de me gusta
Hi kalyanar,
Please see below:
ArrayList<InternetAddress> emailRecipients = new ArrayList<InternetAddress>(); emailRecipients.add(new InternetAddress(email_address)); Map<String, String> mailTokens = new HashMap<String, String>(); mailTokens.put("xxx", xxx); mailTokens.put("yyy", yyy); HtmlEmail email = new HtmlEmail(); Resource templateRsrc = request.getResourceResolver().getResource(templatePath); final MailTemplate mailTemplate = MailTemplate.create(templateRsrc.getPath(), templateRsrc.getResourceResolver().adaptTo(Session.class)); email = mailTemplate.getEmail(StrLookup.mapLookup(mailTokens), HtmlEmail.class); email.setCharset("UTF-8"); email.setTo(emailRecipients); if (messageGatewayService != null) { messageGateway = messageGatewayService.getGateway(HtmlEmail.class); messageGateway.send(email); }
templatePath link to a html node eg. "/workflow/email/xxx.html", thanks for your reply.
Vistas
Respuestas
Total de me gusta
Hi,
Just in case if anyone need solution, this issue is temporary fixed by wrapping my HTML email content with a "<pre style="white-space:initial"> HTML CONTENT </pre>".
Thanks.
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas