Unable to fetch picture to include in email

Unable to fetch picture to include in email

  

Hi,

We have lately been experiencing errors when sending emails which contain external pictures included with:

  • (...)<img src="http://site.com/picture.png">(...)

From Service Center's logs it looks like the platform is trying to replace the HTML <img> tag with its corresponding base64 inline image and, for that purpose, it needs to fetch it from the server hosting it. This fails because the frontend is isolated and can not access the outside world.

From the error stack we have:

[1] Unable to fetch 'https://theSite/thePicture.png' to include in email
   at OutSystems.HubEdition.RuntimePlatform.Email.EmailHelper.#dAb(Boolean ssIncludeImages, String ssBoundary, Boolean use_multipart_related, String relatedBoundary, Hashtable uri2cidMap, String userAgent)
   at OutSystems.HubEdition.RuntimePlatform.Email.EmailProcessor.CreateEmail(Boolean processAddresses, String ssFrom, String ssTo, List`1 headers, String ssCc, String ssBcc, String ssContentType, String ssCharset, String ssSubject, String ssBody, Boolean ssBodyIsHtml, String ssUrl, Boolean ssIncludeImages, String ssInReplyTo, String userAgent, String realHostname, String& ssBoundary, String& ssMail, String& emailId)

Could the error be related to the ssIncludeImages parameter (in bold above)? In the past this error did not occur (and we were already including external images in our emails). We have not updated our Platform Server version (10.0.604.0) and, as far as I can recall, our email-related flows have not changed either.

Do you have any ideas as to why this might be happening?

Thanks!

Rui

If the image is outside this server, it's going to fail because, as you said, "the frontend is isolated and can not access the outside world".

If the image is on that server, the problem is probably a DNS resolution problem ("theSite" is not resolving) or the image no longer exists at that address.

In this situation, my suggestion is to bring this image into your application and use it as a static image, not an external image. External images just adds more possible points of failure.

J.Ja

Hi Justin,

Thanks for your reply. However, after reading my own post again, I believe my question is not clear. What I really wonder is why does the platform need to access the image in the first place.

The only reason I can think of for the platform to fetch the image is to replace the <img> tag with the corresponding base64 data. This should not be its behavior, I believe - it should leave the HTML untouched when sending the email.

Thanks for your help,

Rui

Yes, that is the EXACT reason for it. It's non-changeable behavior. I understand *why* it does that, but it's a matter of debate, and ideally you could change it. My suggestion would be to inject an img tag in manually with an expression and see if that works better.

J.Ja

Hi,

I'll look at the code and see if I can find some workaround - your suggestion might be a possibility.

Thanks again for your response!

Rui

Fingers crossed!

J.Ja

Solution

Hi,

Since the images are included by the end-user in the emails, it is not possible to add them as static resources in the application as we don't know a priori which images the user will include.

As a workaround, we are now parsing the HTML code and replacing all external images by an embedded default 'broken image'.

Regards,

Rui

Solution