command line thunderbird -compose embedding images
I am scripting the creation of e-mails using the command line
-compose ...
and now trying to incorporate embedding certain images. I created a routine to encode the images in base64 and build the proper HTML img tag to include in the 'body' argument.
It works flawlessly for png and jpg images, but bombs for bmp, tiff, gif, ... and am trying to understand why. Is this a limitation of the command line? Is there something I've missed in the documentation somewhere?
I've validated with online source that the output HTML is accurate. I've even saved the output as an HTML file and it renders just fine in any web browser, it is just the 'thunderbird -compose -body ...' that can't seem to handle it.
I am running the latest version of Thunderbird (installed a fresh copy today).
If anyone has any ideas, I'd love to hear it.
Thank you.
Modified
الحل المُختار
just another point, Thunderbird - compose has an inherent path to the executable, but all the following command line parameters will also contribute to the path I think as it is a single string in memory.
I will guess that the string you are using is unicode, so the limit is 32,767 characters not 256 it is about the naming convention used at the start of the path.
The link I provided shows an opt in registry setting for getting longer paths, but it is windows Windows 10, Version 1607 and after only. That is build number 10.0.14393 which was released on the first anniversary of windows 10s release.
Did you try applying the reg file at the link?
Read this answer in context 👍 0All Replies (11)
bombs how? Rendering in the composer is not always as good as rendering of received messages.
Sorry, I should have given more details.
I am using vba and building up a command that then gets run via
CreateObject("WScript.Shell").Run
it works fine for jpg and png, but reports a
Method 'Run' of object 'IWshShell3' failed
for gif, bmp, tif ....
Modified
Where'd my reply go?! Let's try this again.
I am using VBA to build up a command and then run it by doing
CreateObject("WScript.Shell").Run
This works flawlessly for jpg and png, but errs with gif, bmp, tiff... and reports
-2147024690 Method 'Run' of object 'IWshShell3' failed
a search of google for the vbscript error 2147024690 indicated the path including the file name is to long. Windows has a limit of 256 characters, but reality is it is more like 255.
It is not all that hard to exceed the 255 limit, especially if the path to somewhere like the temp folder is long already and file names are also long. Your error is a vbsript error, not a Thunderbird one as far as I can see.
When embedding jpg, png files my command is 7003 and another test 18394 characters long and work fine.
That said a gif gives 49995, a tiff gives 118080, a bmp gives 1205913 characters. So perhaps there is a limit, but it isn't 255. I'll try and do some testing.
Assuming the length is the issue, I could first save the html to a file, is there any way with -compose to read that in as the body?
The path including the file name is limited to 255 characters. If you do not know what the path is, I suggest you read some of the documentation Microsoft publish. It has nothing at all to do with string lengths.
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
I'm doing
thunderbird -compose '...'
So there is no issue with path length beyond the length of the thunderbird options. Even if that was the cause it wouldn't explain why it works fine for jpg/png, but not other file types.
I've switched to generating the HTML and saving it as a file that I then pass to the -message input argument. I didn't want to use it as it makes useless I/O actions, but it works and that the important thing at the end of the day.
Modified
You are doing
CreateObject("WScript.Shell").Run
This works flawlessly for jpg and png, but errs with gif, bmp, tiff... and reports
-2147024690 Method 'Run' of object 'IWshShell3' failed
and the error is in the run.
I have no idea what the script is because you have not shared that.
I would like to point out this is not a coding forum, it is an end user support forum for using Thunderbird. Not a programing forum and certainly not for vbScript which really no one uses here as JavaScript is the scripting language of Thunderbird.
الحل المُختار
just another point, Thunderbird - compose has an inherent path to the executable, but all the following command line parameters will also contribute to the path I think as it is a single string in memory.
I will guess that the string you are using is unicode, so the limit is 32,767 characters not 256 it is about the naming convention used at the start of the path.
The link I provided shows an opt in registry setting for getting longer paths, but it is windows Windows 10, Version 1607 and after only. That is build number 10.0.14393 which was released on the first anniversary of windows 10s release.
Did you try applying the reg file at the link?
Thank you Matt,I believe this is the issue. I have to do some testing.
I can't go messing with user registry settings, so the workaround is to save the an html file and use it as the -message input. It will have to suffice.
Thank you for sticking with me to figure this out. Greatly appreciated!
After testing, on my PC (need to test on a few others) the limit is of 32723 characters before the WshShell.Run bombs.