DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Outlook Mailitem

  1. #1
    srini Guest

    Outlook Mailitem


    Hi All,

    I have a VBA application which sends a worksheet as text in an email
    using Outlook objects.

    Code looks like this ..

    Dim objOutlook As Outlook.Application
    Dim objMailItem As Outlook.MailItem
    Dim objOlNS As Outlook.NameSpace

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    ' Send the files in an email.
    '
    Set objOutlook = New Outlook.Application
    Set objOlNS = objOutlook.GetNamespace("MAPI")
    objOlNS.Logon
    Set objMailItem = objOutlook.CreateItem(olMailItem)
    objMailItem.To = strTo
    objMailItem.Subject = strSubject
    objMailItem.HTMLBody = "<html> <body> <pre> " & strBody & "</pre> </body>
    </html>"

    objmailitem.send

    The mailformat of the email in my sent items is html but when it reaches
    the inbox it is plain text and hence loses the formatting.

    Is there any way to specify what should be format?

    Thanks,
    -Srini.


  2. #2
    Paul Clement Guest

    Re: Outlook Mailitem

    On 15 May 2001 09:45:55 -0700, "srini" <srinit74@yahoo.com> wrote:


    Hi All,

    I have a VBA application which sends a worksheet as text in an email
    using Outlook objects.

    Code looks like this ..

    Dim objOutlook As Outlook.Application
    Dim objMailItem As Outlook.MailItem
    Dim objOlNS As Outlook.NameSpace

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    ' Send the files in an email.
    '
    Set objOutlook = New Outlook.Application
    Set objOlNS = objOutlook.GetNamespace("MAPI")
    objOlNS.Logon
    Set objMailItem = objOutlook.CreateItem(olMailItem)
    objMailItem.To = strTo
    objMailItem.Subject = strSubject
    objMailItem.HTMLBody = "<html> <body> <pre> " & strBody & "</pre> </body>
    </html>"

    objmailitem.send

    The mailformat of the email in my sent items is html but when it reaches
    the inbox it is plain text and hence loses the formatting.

    Is there any way to specify what should be format?

    Thanks,
    -Srini.

    Unless you're using Outlook 97 or there is a problem with your HTML I don't see anything obvious.

    Are the HTML tags displaying in the text of the message?


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  3. #3
    Srini Guest

    Re: Outlook Mailitem


    Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >On 15 May 2001 09:45:55 -0700, "srini" <srinit74@yahoo.com> wrote:
    >
    >
    > Hi All,
    >
    > I have a VBA application which sends a worksheet as text in an email
    > using Outlook objects.
    >
    > Code looks like this ..
    >
    > Dim objOutlook As Outlook.Application
    > Dim objMailItem As Outlook.MailItem
    > Dim objOlNS As Outlook.NameSpace
    >
    > Application.ScreenUpdating = False
    > Application.DisplayAlerts = False
    > ' Send the files in an email.
    > '
    > Set objOutlook = New Outlook.Application
    > Set objOlNS = objOutlook.GetNamespace("MAPI")
    > objOlNS.Logon
    > Set objMailItem = objOutlook.CreateItem(olMailItem)
    > objMailItem.To = strTo
    > objMailItem.Subject = strSubject
    > objMailItem.HTMLBody = "<html> <body> <pre> " & strBody & "</pre>

    </body>
    > </html>"
    >
    > objmailitem.send
    >
    > The mailformat of the email in my sent items is html but when it reaches
    > the inbox it is plain text and hence loses the formatting.
    >
    > Is there any way to specify what should be format?
    >
    > Thanks,
    > -Srini.
    >
    >Unless you're using Outlook 97 or there is a problem with your HTML I don't

    see anything
    >obvious.
    >
    >Are the HTML tags displaying in the text of the message?
    >
    >
    >Paul ~~~ pclement@ameritech.net
    >Microsoft MVP (Visual Basic)


    I am using Outlook2000 SR-1. HTML tags are not displayed in the message.
    I also tried something like <b> Test </b> in the body. This text is displayed
    in the text but not in bold.

    Thanks Paul.

    -Srini.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center