PDA

Click to See Complete Forum and Search --> : send email in both HTML and TXT format


hmcheung
Mar 14th, 2001, 11:13 PM
I'm using VB to generate emails in the outbox of outlook 2000. My code is like this:

set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = rs!email
.Subject = mySubject
.HTMLbody = "..................... "
.Send
End With
set objOutlookMsg = Nothing


Like this I can only send emails in HTML format. If the user is using a text-only email client, he can't read the email correctly. What should do to make the email in HTML and TXT format where appropriate? Thanks a lot!!

vbuser1976
Mar 15th, 2001, 08:16 AM
Use .body for text messages. I have an app that uses outlook too, but my emails are in text and I use .body instead of .HTMLbody

I hope this helps.

hmcheung
Mar 15th, 2001, 08:23 AM
Thanks very much. I tried to use .body but the outcome is that the email body contains HTML tags. I'd like that when an HTML-enabled email client read the mail, it'll present the HTML version, otherwise, it'll display the plain txt version.
I think there will be something to do with the MIME type. Any ideas?

vbuser1976
Mar 15th, 2001, 08:32 AM
What you are going to have to do is try to set up an if statement that checks the users preferences. But you will have to write out the body twice. One for .htmlbody and .body. Or maybe you can ask the user beforehand what type of email format they want and then create two separate subs, one for html and one for text. I don't know of any other ways to do this. Hopefully, someone else on this forum might have a different idea.

Sorry I couldn't help you more. Good Luck.