how can one turn off Content-Type: text/html ? (wodWebServer / wodWebServer.NET)
I've been testing wodSmtp.ocx 1.3.1.51 for a few days now.
I'm using VBA6 in MS Access 2003.
What I would like to do is Connect, send about 100 messages,
and then Disconnect.
Some of the message are just plain text,
and some have both plain text and HTML. The 2 types are random.
When required, I would like to create Message.HTMLText myself.
The problem occurs when a message with both plain and html,
is followed by one with just plain.
For the 2nd one, if I assign Message.HTMLText = ,
then the 2nd message just has an empty text/html part.
This is not good.
I figure that maybe I could find out the initial value of HTMLText,
and assign that to the 2nd message,
but if I try to inspect Message.HTMLText, I get this error:
-2147467259 Method 'HTMLText' of object 'ISmtpMsg' failed
I know that if I delete the WODSMTPLib.wodSmtp object,
and make a new one, then the text/html part is turn off,
but I do not want to delete.
Can you help ?
Thanks,
Glenn
Re: how can one turn off Content-Type: text/ht
Hi Glenn,
Can you show me a code snippet of how you create messages?
Did you try using CreateSimple and CreateTextHTML methods?
Do they work? Can you try that?
Regards,
Damba
Re: how can one turn off Content-Type: text/ht
Hi Damba,
I tried CreateSimple() and CreateTextHTML() and these are good.
Here is what seems to be happening - please correct me if I'm wrong.
When you call CreateSimple() it deletes all the Message Parts (if any).
It also deletes the Headers (including any custom headers you may
have added) and rebuilds them, using parameters passed to CreateSimple().
During the headers rebuild, it sets the Message Content-Type to text/plain .
When you call CreateTextHTML() it creates 2 message Parts (in the Parts collection).
Part 0 has the PlainText, and Part 1 has the HTMLText.
It also deletes the Headers (including any custom headers you may
have added) and rebuilds them, using parameters passed to CreateTextHTML().
During the headers rebuild, it sets the Message Content-Type to multipart/alternative .
Appropriate parts boundaries are put in the body.
When you assign the Message.PlainText to something.
A new Part with Content-Type = text/plain is created,
and the Content-Type of the message itself is set to multipart/alternative .
Similarly, when you assign the Message.HTMLText to something.
A new Part with Content-Type = text/html is created,
and the Content-Type of the message itself is set to multipart/alternative .
The only way to remove all the Parts seems to be calling CreateSimple(),
but this has the side effect of deleting the Message Headers too.
So it would be nice if the Parts collection had an explicit RemoveAll(),
like SmtpHdrs, for experienced users.
After posting my question, and before you suggested CreateSimple() and CreateTextHTML(),
I found a workaround, but not as nice.
Instead of:
m_Mailer.Message.HTMLText =
you can do
m_Mailer.Message.Parts.Item(1).Body =
This has the effect that no text/html part appears in the message -
there is absolutely nothing between the appropriate boundaries.
But the Content-Type of the message itself is still multipart/alternative (not as nice).
Note that this contradicts the documentation, which says
Body is a readonly property ...
Writing to Body property is not possible.
Glenn
Re: how can one turn off Content-Type: text/ht
Hi Glenn,
I'm not 100 sure what you're trying to do exactly. Can you show me the code you use to create messages? Or perhaps send me a sample so I could duplicate the issue on my side?
If that's possible, you can send it to [mail=techsupport@weonlydo.com]techsupport@weonlydo.com[/mail].
Also, would RemoveAll in wodSmtpMsgs solve your problems?
Regards,
Damba
Re: how can one turn off Content-Type: text/ht
Damba,
I'm not 100 sure what you're trying to do exactly.
I should have made it more clear after I wrote:
I tried CreateSimple() and CreateTextHTML() and these are good.
that this solution is satisfactory, and this issue is closed.
The rest of my reply is simply my understanding of what
is really happening behind the scenes, which might also help
other users of the software.
Are there any mistakes in my explanation ?
Also, would RemoveAll in wodSmtpMsgs solve your problems?
My problems are solved. The issue is closed.
RemoveAll in wodSmtpMsgs is my suggestion for a cleaner solution - that's all.
Glenn
Re: how can one turn off Content-Type: text/ht
Glenn,
Sorry for misunderstanding, I thought that the issue is still existant. I'm glad that it is resolved.
However, we have also implemented the RemoveAll method. You can download the update from our website and try it out if you wish.
Regards,
Damba
Re: how can one turn off Content-Type: text/ht
Glenn,
However, we have also implemented the RemoveAll method. You can download the update from our website and try it out if you wish.
Regards,
Damba
Wow ! Fast ! Thanks !
I tried it and it works (v 1.3.3)
I just noticed that on 01-06-2006, in this forum,
Michael asked for a similar feature.
Glenn