Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
SAP Business Technology Platform's Integration Suite(Formerly SAP CPI) have the ability to send mails through Mail adapter. We can send the attachments along with a well formatted body of the mail. Refer blog by ajay.vaddemani.

Many of us have the requirement to send the Image to the mail body, for which typically Base 64 encoded image can be called in HTML body as described by  sriprasadshivaramabhat in his answer.
However, Base 64 adapter is not well supported in many of the eMail clients. below table suggest the behavior with different email clients.


My observation with Outlook 2016 was that Base 64 images were displayed when we receive the mail, but it gives error when we try to download/Save the image from mail, or try to forward the mail. It simply says "The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link point to the correct file and location." screenshot below.




 

Due to these restrictions Base 64 is not an efficient way to embedd images in the mail body.

Alternatively we have 3 more ways to do this:

  1. Linked Images, hosted pictures called in HTML through URL- used widely, but we need to host image in an server or hosting agent.

  2. Background image in CSS- create background Image style in HTML and call that style in the HTML body, not efficient as it also need Base 64 image to be loaded in CSS Style.

  3. Embedding images using CID attachment- I found this to be an impressive way which doesn't need any external server to host the image and base 64 as well.


 

We will understand the option Embedding images using CID attachment in this blog using a simple SFTP to load image and Mail adapter to send the image.

In order to achieve this we just need to pass the image in Attachment and then call the image in HTML mail body using Content-ID.

1. Use SFTP to load the image- this process varies as per your requirement, you can call the image from a Data store as well.

2. Create a Content-ID Header in Content Modifier

3. Load the image in Mail adapter as attachment

4. Call the attachment using cid in the HTML body.


Iflow:


Content Modifier: create constant Header Content-ID and pass any logical value within <> as shown in the screenshot, I have used Content-ID as <image>


 

Mail adapter:


Create attachment and pass your Image which was loaded as either Body or Header, we have the image in the Body hence we have passed Body in the attachment source,refer below screenshot. Name of attachment should be same as the Content-ID which we have created in Content modifier header (without <>) otherwise it will not work as expected.


Now we can call the attachment through cid in the img tag of HTML (Without <>).


 

Following the above steps we can successfully send the image embedded in the mail body and it resolves the restriction of forwarding or Downloading/Saving the image from mail that we were facing in Base 64 technique.

References:

https://mailtrap.io/blog/embedding-images-in-html-email-have-the-rules-changed/#Inline-embedding-or-...

https://sendgrid.com/blog/embedding-images-emails-facts/

 

2 Comments
Labels in this area