@mcorru, that’s a very interesting question.
I’m getting there doing it with Thunderbird by using base64 encoding of the image; clicking Insert ->HTML, then in the dialog box adding <img src="<your base64 encoded data file, which should start with ‘data:image/jpeg;base64’>" /img>
I have a rudimentary recording I’m not ready to post yet, because using “Type Into” to get the variable into the dialog box takes - literally - over 5 minutes for an 18kb base64 file.
However, since you’re using Exchange, and can use Exchange Web Services, you might find a starting point from the samples here.
However, where the example shows:
Dim html As String = "<html><head></head><body><img width=100 height=100" & _
" id=""1"" src=""cid:Party.jpg""></body></html>"
you might replace
src=""<your base64 encoded data file, which should start with 'data:image/jpeg;base64'>""
I don’t have access to Exchange, so I apologize for being of little help. I will post my Thunderbird results when they are fit to be seen.
EDIT: Here’s a quick-and-dirty but working Thunderbird example. You may have to tweak file paths and selectors, but it does work fine and is not slow.
SendImageInEmail.zip (15.9 KB)
The files should be SendImageInEmail.xaml, project.json, and data_helloworld.src (which contains the base64 encoding of the jpeg).
Just as a rundown of the workflow:
- Open Thunderbird (as it is, if Thunderbird is already open it won’t work, but this is just a test anyway)
- Find the ‘Write’ pushbutton (I don’t click it, because I want to send hotkeys).
- Send ‘Alt-m’ as a Hotkey to open the ‘Message’ menu
- Send ‘n’ as a Hotkey (and not Ctl-N, as the menu says)
- Read the text file ‘data_helloworld.src’ which contains the base64 encoded jpeg.
- Assign it to the variable ‘imageString’
- Assign “<img src=” & imageString & " /img>" to ‘htmlString’.
- Set ‘htmlString’ to clipboard (this to get around the long wait from ‘Type Into’
- Attach the Thunderbird ‘Write’ window (this may not be necessary, but it’s in there and at least works)
- Click into the message area of the email where you want the image to go (I just clicked at the top).
- Send ‘Alt-i’ as a Hotkey to open the ‘Insert’ menu in the ‘Write’ window
- Send ‘h’ as a Hotkey to open the HTML dialog box
- Click into the ‘editable text’ dialog which is for the HTML
- Send ‘Ctl-v’ as a Hotkey to insert clipboard contents.
- Click ‘Insert’ button (I should probably have added a delay here for bigger image files).
- Added a Message Block to block the thread, since this is just a test and not for production.
(I had this image already base64’d, so that’s what I used)