Results 1 to 4 of 4

Thread: send email in both HTML and TXT format

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Hong Kong
    Posts
    62

    Question

    I'm using VB to generate emails in the outbox of outlook 2000. My code is like this:
    Code:
    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!!
    Please Visit My WebCam!!
    http://www.hmcheung.com

  2. #2
    Hyperactive Member vbuser1976's Avatar
    Join Date
    Sep 2000
    Location
    Yonkers, NY
    Posts
    404

    Cool okay...

    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.
    -vbuser1976
    VB6 Enterprise SP6
    SQL 7.0 SP2
    VBScript, HTML, Javascript, C++, a little UNIX

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Hong Kong
    Posts
    62

    .body

    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?
    Please Visit My WebCam!!
    http://www.hmcheung.com

  4. #4
    Hyperactive Member vbuser1976's Avatar
    Join Date
    Sep 2000
    Location
    Yonkers, NY
    Posts
    404

    Lightbulb yeah,...

    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.
    -vbuser1976
    VB6 Enterprise SP6
    SQL 7.0 SP2
    VBScript, HTML, Javascript, C++, a little UNIX

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width