Solved

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

Posted on 2008-10-09
1
259 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How calculate median 5 38
Help with SQl and UNION 7 16
EXCH2013 - Archive mailboxes 2 12
DSum between dates 5 11
Use email signature images to promote corporate certifications and industry awards.
Resolve DNS query failed errors for Exchange
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now