Okay, so a brief answer to my questions based on through research:
No, not possible with the hMail API.
Could we modify MIME header somehow?
However it is possible to use oMessage.Filename
, which will return the path and file name containing the eml data.
It is possible to open the eml file and edit it right away.
However this is possible scenario when the email is saved into the database. I am not sure what is happening with it during the transport, 'cause was unable to find a proper diagram with the mail Path during transport (like the one qmail has for example).
So we need to instruct hMail to add inline attachment.
What I saw after a bit of experiments (the file path name etc is for illustration purposes):
Using the oMessage.attachments.add("c:\attach.html")
Code: Select all
Content-Type: application/octet-stream; name="attached.html"
Content-Disposition: inline; filename="attached.html"
What I do not like here is the base64 encoding, and the content-type.
However written so it is universal. Mind the Content-Disposition: inline;
If the e-mail client could read it, it'll display it inline, otherwise will show it as an attachment. Which Content-Disposition: attachment;
will do as well.
Since base64 encoding of text adds another 30% to the size of the attachment, I am strongly against this, especially having in mind that the attached data is html/text.
So here's a small scenario what a vbs should do (do not know how to write it, 'cause my vbs knowledge is very limited):
Code: Select all
' add empty file to the message, lenght only 1 byte containing a HEX Character for Space 0x20
'Save the message
'open the message as text via oMessage.filename
' Find <Content-Type: application/octet-stream; name="attached.html">
' Change it to <Content-Type: text/html; charset="Windows-1251" name="attached.html">
' Goto one line up and change <Content-Transfer-Encoding: base64> to <Content-Transfer-Encoding:>
' find <IA==> and replace it with <htmlText> variable build before.
Could I get some help in codding this scenario?