HTML mail problema

Giganews Newsgroups
Subject: HTML mail problema
Posted by:  Pier Alberto GUIDOTTI (pguidotti@#remove_this#analysisbo.it)
Date: Mon, 23 Aug 2004

I'm using INDY 10.0.19 to send HTML mail in my VB.NET app.
I'm experiencing a strange problem. When a mail is received by Outlook
Express, I see two attachment, one for the text/html version and one for the
text/plain version, while when the mail is received by Outlook XP, I don't
see attachment but I see the clip symbol in the message list.
Here is the code I use to build the message:

msg = New Indy.Sockets.IndyMessage.Message
msg.From.Address = senderAddress
msg.From.Name = senderName
msg.ContentType = "multipart/alternate"
msg.CharSet = "iso-8859-1"
msg.ContentTransferEncoding = "Base64"
msg.Encoding = Indy.Sockets.IndyMessage.MessageEncoding.meMIME
msg.subject=subject
...
Dim txt As Indy.Sockets.IndyText.Text
Dim html As Indy.Sockets.IndyText.Text
Dim b As String
txt = New Indy.Sockets.IndyText.Text(msg.MessageParts, Nothing)
txt.ContentType = "text/plain"
txt.CharSet = "iso-8859-1"
txt.ContentTransfer = "Base64"
txt.Body.Text = "My text"

html = New Indy.Sockets.IndyText.Text(msg.MessageParts, Nothing)
html.ContentType = "text/html"
html.CharSet = "iso-8859-1"
html.ContentTransfer = "Base64"

b = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" +
vbCr + vbLf
b += "<HTML>" + vbCr + vbLf
b += "<HEAD>" + vbCr + vbLf
b += "<META http-equiv=Content-Type content=""text/html;
charset=iso-8859-1"">" + vbCr + vbLf
b += "</HEAD>" + vbCr + vbLf
b += "<BODY>" + vbCr + vbLf
b += "Mt text"
b += "</BODY>" + vbCr + vbLf
b += "</HTML>"
html.Body.Text = b

....

Where I am wrong? I compared a message sent by Outlook Express with a mail
generated by the above procedure, and I didn't see differences that justify
the two parts of the message being interpreted as attachments.
Thanks in advance.

Pier Alberto GUIDOTTI

Replies