Results 1 to 2 of 2

Thread: VB n Outlook send email help pls

  1. #1

    Thread Starter
    Member micromax's Avatar
    Join Date
    Mar 2001
    Location
    England
    Posts
    61

    VB n Outlook send email help pls

    A very helpfull chap called Bruce sent me this code in response to a request from me - The problem was that the emails from my app were going as rich text and not text.

    This is the code I am using:
    --------------------------------------------------------------------------------
    Private Sub Auto_Send()
    Dim objOutlook As New Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem

    'Create new message
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

    ' Set all desired Outlook properties
    With objOutlookMsg
    .To = "userid@users_address"
    .Subject = "Automated email test"
    .Body = "This is line 1" & vbcrlf
    .Body = .Body & "This is line 2" & vbcrlf

    {.BodyText as text?????? not HTML}

    .Importance = olImportanceHigh
    .Send
    End With

    Set objOutlookMsg = Nothing

    'Close Outlook instance: Important!
    Set objOutlook = Nothing

    MsgBox "Auto Email Complete", vbInformation

    End Sub
    --------------------------------------------------------------------------------
    The emails I send using this code get sent as rich text format and the only other format option seems to be HTML. Do you know of anyway to send them and set the email format to plain text?

    NB: My Outlook settings are plain text.

    Thanks in advance.

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    After some research on the Outlook object model, I found this:
    If you want to populate the body of the message and still send the message in Plain Text format, you can use the Collaboration Data Objects (CDO) object model. The CDO object model sends Plain Text messages by default.
    from here http://support.microsoft.com/support.../Q222/2/48.ASP

    so it looks like you need to use CDO to send your plain text messages


    Tom

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