1
votes

I am setting up a bulk emailing solution combining Logic Apps and SendGrid.

User sends email to a mailbox with attachment of required recipients > Logic App reads email > LA resends 'Body' via SendGrid for each recipient.

This works fine with a plain email. However, when an image is embedded within the body Outlook uses Content-IDs.

Currently the body of the email just says a broken image symbol.

How can the images be kept for the re-sending on?

enter image description here

1
Any update now? Or do you still have other problem? - George Chen
Thanks George, that worked. (still working out how to reply on here) It's not 100% what I'm after though. So what's happening is that I'm trigger when an email is received into a mailbox using the Outlook O365 trigger. I'm then setting the body of the received email to a variable and then want to resend the body on using the SendGrid action. Does that make sense? - CarlD
I don't test with send grid, so I can say it won't work. However the send mail(v3) with send grid body require html, so maybe you couldn't send it directly. - George Chen
I've also tried using the normal Outlook O365 send mail action but get the same results. I've added a screenshot to the original post and here i.stack.imgur.com/rCRuo.jpg - CarlD
Actually I have test the action, It's same because the body in the picture I pasted doesn't contain the picture information, so if you want to resend the mail you have to extract the image contentbytes and send it. - George Chen

1 Answers

1
votes

If you want to implement it directly, it could be done. Because if you try to get the mail body you will find it's like below picture.

enter image description here

The body is escaped mail content and the image content is the contentBytes under attachments it's a base64 code.

So if you want to send a image from another mail you have to get the base64 code embed it to your mail. I use the outlook trigger to test it and send with sendgrid, the content will be like this code.

This is test email <br>\n<img src=\"data:image/jpeg;base64,@{triggerBody()['attachments'][0]['contentBytes']}\">

enter image description here

enter image description here

I test this way could send the image, and it could be seen in the mail. If this is not what you want please let know.