Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Send Email with CDO 4    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Sending HTML Though Gmail
Tom Mura 
     
2 years ago
When I have everything set to send the email as HTML and paste the code into the body it comes out as code when the email is received.

SendOk = SendEmail(Email, "[email protected]", Subject,Body, Nz(ReplyTo), Nz(CC), Nz(BCC), True, Nz(Attachment, ""))

The Body field is set to Rich Text.

Any help would be appreciated.
Kevin Robertson  @Reply  
          
2 years ago
Have you set it up correctly in the SendEmail() function to send HTML emails?
Tom Mura OP  @Reply  
     
2 years ago
I believe so:
Public Function SendEmail(MsgTo As String, MsgFrom As String, MsgSubject As String, _
                          MsgBody As String, _
                          Optional MsgReplyTo As String = "", Optional MsgCC As String = "", _
                          Optional MsgBCC As String = "", Optional SendAsHTML As Boolean = True, _
                          Optional Attachment As String = "") As Boolean

From what I am reading, Gmail doesn't allow HTML to be entered in the body of an email. It looks like Rich Text is the closest it will get. Am I missing something?
Kevin Robertson  @Reply  
          
2 years ago
Do you have this block of code?

        If SendAsHTML Then
            .HTMLBody = MsgBody
        Else
            .TextBody = MsgBody
        End If
Tom Mura OP  @Reply  
     
2 years ago
Yes
Michael Barkemeyer  @Reply  
    
2 years ago
I ran into that issue myself.  It seems that when using VBA to send HTML your HTML code needs to be concatenated as text.
As VBA only allows 25 line continuations, you may need to break up the code into different parts to get around that limitation.

As per the rules I can't post a lot of code, so here is a snippet.

    Footer = "<div class='divider'></div>" & _
             "<div style='background-color:#E6E6E6; padding: 10px;'>" & _
             "<div style='text-align:left;'>" & AgentBlock & "</div>" & _
             "<div style='text-align:left; margin-top:10px;'>" & _
             "<img src='" & FooterLogo & "' alt='Broker Logo' width='150' height='auto'></div>" & _
             "</div>" & _
             "<div style='background-color:#747474; color:white; padding: 10px; font-size: 8pt;'>" & _
             LegalSmallPrint & "</div>" & _
             "</body></html>"

    Body = Header & Navigation & Footer

    ' Send the email
    SendOK = SendEmailWithHostedImage(toEmail, fromEmail, Subject, Body, ReplyToEmail, CCEmail, BCCEmail, True)
Tom Mura OP  @Reply  
     
2 years ago
Thanks Michael!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Send Email with CDO 4.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/20/2026 10:04:11 PM. PLT: 0s