Expand my Community achievements bar.

SOLVED

Email sent using Message Gateway has lot of empty spaces in Outlook/Gmail applications

Avatar

Level 5

Hi all,


When trying to send out emails via AEM using message Gateway service (Emails configured via CQ Mail Service)

 

aem_noob_3-1713146893692.png

 

when inspecting on web mail applications there are lot of nested <div> which have no occurrence in the original html.

any suggestions on why this would be happening?

 

@arunpatidar@EstebanBustamante@Raja_Reddy

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
    Email email = new HtmlEmail();

Can you try changing the Email class to HtmlEmail class?

org.apache.commons.mail package has the below classes - 

Rohan_Garg_0-1713255884424.png

HtmlEmail has start string has <html><body><pre>

Rohan_Garg_1-1713256277625.png

 

Thanks,

Rohan Garg

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @aem_noob , Are you using any customized email template or OOTB email template. If you are using customized template please check the template structure.

 

Please refer for more details on email templates,

https://medium.com/@toimrank/aem-email-custom-template-style-and-attachment-d4c0a196ec98

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/where-can-find-email-templ...

Avatar

Level 5

we're using custom email templates.

We checked the template structure but there is nothing in the markup for the page when seen on view as published.

It is only when viewing the mail we see empty spaces.

 

Avatar

Community Advisor

@aem_noob can you please check whether your template is following all the required  configurations mentioned in https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operati...

 

if it possible can you please share the template?

Avatar

Level 5

@sravswe are using custom template which is basically a page created from an email based template. We are using dynamic as well as static strings along with proprietary header footer icons. All of the page is rendering correctly save the empty strings.

we are converting the html page to java string using jsoup and then sending it over email.

Avatar

Level 5

not sure, we are using the below code snip -

public void sendEmail(String contentEmail, String userName, String subjectLine, List<String> emailRecipients) throws EmailException, AddressException {
Email email = new HtmlEmail();
email.setCharset(Constants.CHARACTER_ENCODING_UTF_8);
email.setFrom(Constants.FROM_EMAIL);

Avatar

Correct answer by
Community Advisor
    Email email = new HtmlEmail();

Can you try changing the Email class to HtmlEmail class?

org.apache.commons.mail package has the below classes - 

Rohan_Garg_0-1713255884424.png

HtmlEmail has start string has <html><body><pre>

Rohan_Garg_1-1713256277625.png

 

Thanks,

Rohan Garg