cancel
Showing results for 
Search instead for 
Did you mean: 

CPI: Mail is not formatted, no style

rares_naghi
Discoverer
0 Kudos

Hello everybody,

I have currently a problem while using Mail adapters.

Scenario:
I am checking for new mails each 10 seconds. I check in an outlook Inbox.
If there are new emails using a mail adapter and transport protocol IMAP4 I am taking the emails.
Emails are send using SMTP to another inbox to a CRM system using again a mail adapter.

Configuration of Mail receiver adapter:


Problem:

The style/format of the email is lost. This means, no style, size, colors of the text, new lines, sinature image etc.
Problem persists, even if I send from gmail or outlook mail addresses.
I tried to change the MIME Type, to add Mail Attachments like in the picture above or to change the Content Transfer Encoding. Nothing worked 😞


How I sent it:


How it looks:


I noticed that emojis are being sent good.

How may I keep the format and style?

Best wishes
Rares

Accepted Solutions (0)

Answers (1)

Answers (1)

YayatiEkbote
Contributor
0 Kudos

Hello Rares,

I achieved the same by creating HTML body by using XSLT mapping where I created CSS style inbuilt in HTML page.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes" />
	<xsl:template match="/">
		<!-- TODO: Auto-generated template -->
		<html>
		    <head>
		        <title>CSS formatted mail body</title>
		        <style>
                    h1{
                        font-family: Arial, Helvetica, sans-serif;
                    }
                    
                    p{
                        font-size: 18px;
                    }
		        </style>
		    </head>
		    <body>
		        <h1>Test email Heading</h1>
		        <p>Sample Mail content to demonstrate that this can be achieved through XSLT mapping.</p>
		        <p>Order Number - <xsl:value-of select="/Doc/Header/OrderID"/></p>
		        <p><xsl:value-of select="/Doc/Header/Comments"/></p>
		        <br/>
		        <table style="wdith:100%">
		            <tr>
		                <th>Item</th>
		                <th>Item Name</th>
		                <th>Quantity</th>
		                <th>Unit</th>
		            </tr>
		            
		            <xsl:for-each select="/Doc/Item">
		                <tr>
		                    <td><xsl:value-of select="ItemID"/></td>
		                    <td><xsl:value-of select="ItemName"/></td>
		                    <td><xsl:value-of select="Quantity"/></td>
		                    <td><xsl:value-of select="Unit"/></td>
		                </tr>
		            </xsl:for-each>
		        </table>
		    </body>
		</html>
	</xsl:template>
</xsl:stylesheet>

Generates this output -

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>CSS formatted mail body</title>
      <style>
                    h1{
                        font-family: Arial, Helvetica, sans-serif;
						color: MediumSeaGreen;
                    }
                    
                    p{
                        font-size: 18px;
						color: rgba(255,99,71,0.5);
                    }
		        </style>
   </head>
   <body>
      <h1>Test email Heading</h1>
      <p>Sample Mail content to demonstrate that this can be achieved through XSLT mapping.</p>
      <p>Order Number - 23083110140001</p>
      <p>Sample Order</p>
	  <br/>
	  <table style="wdith:100%">
         <tr>
            <th>Item</th>
            <th>Item Name</th>
            <th>Quantity</th>
            <th>Unit</th>
         </tr>
         <tr>
            <td>202308310001</td>
            <td>Item One</td>
            <td>10.000</td>
            <td>EA</td>
         </tr>
         <tr>
            <td>202308310002</td>
            <td>Item Two</td>
            <td>20.000</td>
            <td>PC</td>
         </tr>
         <tr>
            <td>202308310003</td>
            <td>Item Three</td>
            <td>15.000</td>
            <td>EA</td>
         </tr>
      </table>
   </body>
</html>