Solved

How can VBA send an email that includes both text AND html formats?

Posted on 2008-10-09
1
309 Views
Last Modified: 2013-11-27
I am using VBA in Access 2000 to email to all recipients on a list (on email at a time). It uses Outlook objects for each message and works well with html as the format. How do I include the plain text version in the same email, - so the clients browser or email software can chose plain text if it has too, and html if it is capable? I am assuming the dual format is possible if I use some type of MIME.

Many thanks.  
'we are in a loop which produces single email addresses as the var xx
 
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
    With objOutlookMsg
Set objOutlookRecip = Nothing ' clear previous recipient from loop
Set objOutlookRecip = .Recipients.Add(xx) 
         objOutlookRecip.Type = olTo
         .Subject = Me!subj      '<--Subject
.HTMLBODY = "<HTML><H2><b>This is HTML Text in the BODY of the email</b></H2></HTML>"
        .HTMLBody = "<HTML><Head></Head><Body><table><tr><td>" & hdrtbl & "</td><tr><td><hr>" & Me!msgtxt & "</td></tr><tr><td><small>" & signath & "</small></td></tr></table></Body></HTML>"
              xxx = "Email address ERROR for " & xx
                MsgBox xxx
            End If
        Next
       .Send
 End With
 
'Cleanup Code
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing
Me!Text14 = xx & " " & zz
'go to next email address in loop

Open in new window

0
Comment
Question by:projamr1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
projamr1 earned 0 total points
ID: 22682071
This may be an uncessary concern. Every email client I checked has the ability to show html or at least filter it out.

 
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question