Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Email is coming to mail without HTML format

Avatar

Level 4

Dear All,

I have written one email functionality in AEM.

For this I have setup one custom scheduler and it will check if somebody used the japan page then it will send to me mail.

I have created my email template under /etc/notification/email/html/testapp/notifications/page_access.txt

Below is the content of page_access.txt.

I am successfully getting mail but Issue is that I am not getting mail in HTML format. Whatever in page_access.txt is there same thing I am getting in email ,as shown in below screenshot.

My email content should be look like below.

Issue - Whenever I am getting mail my all HTML format is lost and I am getting same contents which are in the page_access.txt

Thanks,

Sunita

**********************************CONTENT OF page_access.txt *************************************

<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>

</head>

<body>
<pre style="white-space:normal;">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
      <tbody>
        <tr>
          <td align="center" valign="top">

                <table width="600" border="0" cellpadding="0" cellspacing="0" align="center" style="border:1px solid #000000">
              <tbody>
                <tr><td align="left" valign="top"></td></tr>
                <tr>
                  <td align="left" valign="top">

                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tbody>
                        <tr>
                          <td width="20" valign="top" align="left"></td>
                          <td>

                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                              <tbody>
                                
                                <tr>
                                 <td height="10" valign="top" align="center"></td>
                                </tr>
                                <tr>
                                        <td>
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                <tr>
                                                <td valign="top" align="left">
                                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                         <td align="left" valign="top" style="font-family:Arial, sans-serif;font-size:14px;color:#000000;line-height:1;">Dear Content Approver,</td>
                                                         </tr>
                                                          <tr><td height="25" align="left" valign="top"></td></tr>
                                                            <tr>
                                                             <td align="left" valign="top" style="font-family:Arial, sans-serif;font-size:14px;color:#000000;line-height:1.5;">
                                                             This is a notification email to inform you that below page has been changed.
                                                             </td>
                                                             </tr>
                                                            
                                                            <br/><br/>
                                                            <tr><td> 
                                                            <b><ul><li>
                                                            <a href='http://localhost:4502/content/geometrixx/ja/events.html'>test</a>
                                                            </li></ul></b> 
                                                            </td></tr> 
                                                                                
                                                        <tr><td height="20" align="left" valign="top"></td></tr>
                                                        <tr>
                                                         <td align="left" valign="top" style="font-family:Arial, sans-serif;font-size:14px;color:#000000;line-height:1;">Best Regards,</td>
                                                        </tr>
                                                        <tr><td height="20" align="left" valign="top"></td></tr>

                                                        <tr>
                                                        <td align="left" valign="top" style="font-family:Arial, sans-serif;font-size:14px;color:#000000;line-height:1.5;">Sunita
                                                        </tr>
                                                       
                                                    </table>
                                                </td>
                                                <td width="80" valign="top" align="left"></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>

                              </tbody>
                            </table>

                          </td>
                          <td width="20" valign="top" align="left"></td>
                        </tr>
                      </tbody>
                    </table>

                  </td>
                </tr>
                <tr><td height="20" align="left" valign="top"></td></tr>
              </tbody>
            </table>

          </td>
        </tr>
      </tbody>
    </table>
</pre>
</body>
</html>

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi,

I think issue is with your code which sends an email. You might be using SimpleEmail rather than HTMLEmail.  

FYI

AEM Email Service provides simple text email & Html Email. Check the code snippet which sends email and construct Email Object.

Regards,

Jitendra

View solution in original post

5 Replies

Avatar

Level 10

Are you following online docs for this use case - can you please reference that so ppl can try and reproduce. 

Avatar

Level 4

Dear All,

I am following the below online docs for this use case.

http://www.tothenew.com/blog/send-email-and-attach-filesimages-from-aem/

NOTE - Everything is working fine. I am getting mail also. But The format is not coming in HTML in email.

Avatar

Level 3

Hi,

Try to change the extension of your template from .txt to .html

Avatar

Correct answer by
Level 9

Hi,

I think issue is with your code which sends an email. You might be using SimpleEmail rather than HTMLEmail.  

FYI

AEM Email Service provides simple text email & Html Email. Check the code snippet which sends email and construct Email Object.

Regards,

Jitendra

Avatar

Level 9

Check the Content-Type in your message header.  For HTML email it should be set as "text/html;charset=utf-8".

- JK