I am working on a macro to send emails with images embedded. These images are located on a network drive, and this introduced a complication. I was able to send emails with embedded images when the source is a URL, but was unable to do so when referencing the network drive. To solve this, I created a small program using C# to take the image and encode it as a Base64 string. The string gets returned to a text file which the macro then accesses, and I initiate the email from there.
Everything up to the sending of the email works fine; I've checked all steps using MessageModal. The problem I get is that sometimes the image does not display on the email when receiving it. For reference, I and the others who will receive this email use Outlook and the Outlook web client. After some experimenting, I believe that the distinction between whether the image is displayed or not has to do with the size of the image file. Small samples that are around 8KB worked fine but larger ones around 200KB that I actually need to send were not working. I should also note that every image works fine as an attachment, just not as an embedded image in the body.
Is my interpretation of the problem correct, and is there a good solution? I'm also prepared to scrap this and rewrite it if there's a better method available than encoding the image as Base64. TYIA
Embedding Images in Email with HTML Not Sending
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7380
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Embedding Images in Email with HTML Not Sending
Sounds like you're at the mercy of how different email clients choose to render embedded images. Some clients (mine included) don't render images unless I click a button to say I'm happy for it to. I believe this is for security reasons. If you're sending valid HTML, then it's down to how the client works with it and beyond your control.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Embedding Images in Email with HTML Not Sending
That's what the problem was, and was easily fixable.
Much obliged!
Much obliged!