Hello. I’m working on a project that involves sending out a dynamically generated HTML email that contains two images in an HTML email template and I’ve run into an issue. The two images are always fixed & never change, however they cannot be hosted online using a public image hosting site, thus I am required to either use the image’s content ID to embed them or encode them with base64 in the email itself (which I’ve yet to look into).
After searching online, I ran into this post which creates an attachment variable using the image path, then generates a content ID for the attachment which is passed into the body of the email along with passing the attachment variable as an in-argument to the send mail activity. While this worked for a single image, if I attempt to replicate it and add a second image with a new variable/contentID/argument/etc. and run it again, the first image appears in its place (showing 2 images total, but the same image in both places) regardless of the img’s src tag being that of the new content ID for that image & both being passed as attachment arguments correctly.
After some further troubleshooting from this point, I’ve found that whichever image’s content ID is passed first via the attachment arguments, that is the image which appears in all places in the mail body, regardless of anything. The second image won’t end up embedded, but instead simply sent as a regular attachment.
I then attempted using a slightly different approach I found here which is a method to attach more than 1 attachment to an email, and integrated it with the previous workflow. This time, I created a mailMessage variable as well and attached the images via looping through an array containing the image file’s paths/names & adding them via an Invoke Method. Both images successfully attached so I assumed I could embed them by accessing them similar to an array element such as mailMessage.Attachements.Item(0) but this resulted in the same issues from above with both images being the same one regardless of any changes made. I’m starting to run out of ideas as to why the email body only shows duplicates of a single image rather than two different ones even though everything points to two separate images - any ideas? I’m all ears…
Unfortunately I cannot link the code due to it being internal for a company, but the above two posts have links to workflows that are easy to manipulate and replicate the issues I’ve listed.
tl;dr Want to embed two images into an HTML email body w/o using a public image hosting site. Images will attach as regular attachments just fine. Attempted 2 attachment variables & unique contentID variables per image, but this results in both inline images being the same image. Attempted to attach them via Invoke Method & then accessing the attachment elements on the mailMessage variable, but again, both embedded img tags appear as the same image regardless off the src tag differences or element differences (ex: Item(0) vs Item(1) - if I pick Item(3) it says out of bounds as it should).
Any help would be appreciated.