Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Right way to add images in body of email template that works with both Send E-Mail process and apex_mail.prepare_template

RaakaeshJun 26 2023 — edited Jul 26 2023

I have an email template that has body containing this image tag.

<img src="cid:Signature.png" alt="DFA"/>

A button triggers a Send E-Mail Type process that has the following Attachment SQL.

SELECT blob_content
        ,filename
        ,mime_type
    FROM apex_application_files
   WHERE filename = 'Signature.png'
     AND flow_id = :APP_ID;

This setup works flawlessly inside email sent. This setup also fails if I use <img src="#APP_FILES#file.png" alt="ALT_TEXT"/> as mentioned in this post


I have a page to preview this email before it gets sent. On this preview page, I am using apex_mail.prepare_template to fetch the email content into a hidden item which is then displayed in a Static Content Region using &P10715_BODY_HTML!RAW.

In the preview, the image cannot load since there is no way of sending an attachment through a SQL or through p_placeholders when I use <img src="cid:Signature.png" alt="DFA"/>. In this case though, <img src="#APP_FILES#Signature.png" alt="ALT_TEXT"/> works just fine.


What is the right way to include images in the body of an email template that works with both Send E-Mail process and apex_mail.prepare_template?

Reference: https://tm-apex.hashnode.dev/preview-of-your-email-apex-mail-3

This post has been answered by Raakaesh on Jul 4 2023
Jump to Answer
Comments
Post Details
Added on Jun 26 2023
4 comments
2,295 views