Hello everyone,
I’m facing an issue with image URLs in an OutSystems project when sending emails using an HTML template. My project has two flows: one for testing (test flow) and one for production (mainflow). My goal is to use images stored in the Data > Resources tab of the project and reference them using the RuntimePath in my HTML template.
I managed to do this in the test flow, and it works fine in the sent emails. However, when I switch to the mainflow, the images load in the Rich Text component preview, but they're broken both on Outlook and Gmail after sending the emails. The email client I need to use is Outlook, but I'm testing it with Gmail for debugging.
Troubleshooting with Site Property: I attempted to reference images using a Site Property for the base URL combined with the image path, but the behavior is still inconsistent and images are broken in both flows. I got the error Can't identify 'BaseURL' element in expression. Both in the mainflow and test flow in the expression editor of the HTML template.
Troubleshooting with Base64: with a simple Python script, I encoded the images with Base64 and added them to the themplate images src attributes in the both flows. That works in Outlook in both flows, but not in Gmail, which apparently doesn’t support Base64 images. The Gmail behavior is not an issue as I need to use Outlook, but this information may help.
Troubleshooting with hardcoded abosulte URLs: this works in the test flow, but in the mainflow the images are broken with absolute URLs. Upon inspecting the email source, I noticed that the src attribute changes to originalsrc, and the absolute URL I specified becomes a relative path "../appName/image.png". Additionally, the data-imageerror="RelWithoutBase" attribute is also added to the <img> tag, indicating an error in image path resolution.
I suspect there may be some configuration or logic altering URLs before the email is dispatched in the mainflow, but I haven't been able to identify it. I want to use the RuntimePath URLs for images as I did in the test flow, or use the absolute paths as a second option, but I cannot use the base64 for performance reasons, even though that's the one thing that worked in the mainflow (in Outlook).
Has anyone else encountered this issue? Is there a workaround or setting that could fix this?
Hi,
Why you have two branches of logic, one for Test and one for Prod? Is the layout and styling for Test and Prod different?
Regards,
Daniel
Yes, the test layout and styling are simpler than the prod's . I cannot change that because the project was built like this for performance purposes.
Elisa