title: VBA HTML format is lost when message is sent to non-outlook client
body: <p>I have a macro that parses a spreadsheet and compiles emails based on parsed data. The problem that I'm facing is the visual formatting.
  When I use the macro to send the email to an outlook email address, everything works perfectly (html code works), but when I send the same email to, say, gmail web client, I'm losing the html and my email is sent in plain text.
  This is what my email function looks like:</p>
  
  <blockquote>
  <pre><code>Function OutlookEmail(SendTo As String, subject As String, Message As String, send As Boolean)
      Dim Outlook As Object, NewMail As Object, SafeItem As Object, Attach As Object
  
      Set Outlook = CreateObject("Outlook.Application")
      Set SafeItem = CreateObject("Redemption.SafeMailItem")
      Set NewMail = Outlook.CreateItem(0)
      SafeItem.Item = NewMail
  
      With SafeItem
          .Recipients.Add SendTo
          .Recipients.ResolveAll
          .subject = subject
          .HTMLBody = Message
      End With
  
      If send = True Then SafeItem.send
      If send = False Then SafeItem.display
  
      Set Outlook = Nothing
      Set NewMail = Nothing
      Set SafeItem = Nothing
      Set Attach = Nothing
  End Function
  </code></pre>
  </blockquote>
  
  <p>Redemption is an email plugin that helps send everything automatically and Message contains HTML and inline-css formatted text.</p>
  
  <p>Here's what it looks like when sent to an outlook client:
  <img src="https://i.stack.imgur.com/IeTNu.jpg" alt="http://snag.gy/bSLTp.jpg"></p>
  
  <p>Other than below, it's a simple loop with some formatting.
  CSS vars:</p>
  
  <pre><code>Dim CSS_p As String, CSS_phone As String, CSS_table As String, CSS_th As String, CSS_td As String
      Dim CSS_first As String, CSS_last As String, CSS_jlist As String, CSS_warning As String, CSS_accent As String
  
  CSS_p = " style='line-height: 16px;color: #666;margin-top: 10px; margin-bottom: 15px; margin-left: 20px; margin-right: 10px;'"
      CSS_phone = " style='font-weight: bold;'"
      CSS_table = " style='font-size: 14px; text-align: center;'"
      CSS_th = " style='padding: 0 0.5em; text-align:center; " &amp; _
              "border-top: 1px solid #FB7A31; border-bottom: 1px solid #FB7A31; background-color: #FFC;'"
      CSS_td = " style='border: 1px solid #CCC;padding: 0 0.5em; text-align:center;'"
      CSS_first = " style='border-top: 1px solid #CCC; border-bottom: 1px solid #CCC; border-left: none; border-right: 1px solid #CCC'"
      CSS_last = " style='border-top: 1px solid #CCC; border-bottom: 1px solid #CCC; border-left: 1px solid #CCC; border-right: none;'"
      CSS_jlist = " style='border-collapse:collapse;line-width:1px;'"
      CSS_warning = " style='line-height: 16px;color: red;margin-top: 10px; margin-bottom: 15px; margin-left: 20px; margin-right: 10px;'"
      CSS_accent = " style='text-decoration:underline; font-weight:bold;'"
  </code></pre>
  
  <p>Table content:</p>
  
  <pre><code>job_list = job_list &amp; "&lt;tr&gt;&lt;td" &amp; CSS_td &amp; "&gt;" &amp; account &amp; "&lt;/td&gt;" &amp; _
                                            "&lt;td" &amp; CSS_td &amp; "&gt;" &amp; location &amp; "&lt;/td&gt;" &amp; _
                                            "&lt;td" &amp; CSS_td &amp; "&gt;" &amp; address &amp; "&lt;/td&gt;" &amp; _
                                            "&lt;td" &amp; CSS_td &amp; "&gt;" &amp; work_order &amp; "&lt;/td&gt;" &amp; _
                                            "&lt;td" &amp; CSS_td &amp; "&gt;" &amp; description &amp; "&lt;/td&gt;" &amp; _
                                            "&lt;td" &amp; CSS_td &amp; "&gt;" &amp; service_date &amp; "&lt;/td&gt;&lt;/tr&gt;"
  </code></pre>
  
  <p>Message:</p>
  
  <pre><code>           email_body = "&lt;html&gt;&lt;head&gt;&lt;/head&gt;" &amp; _
                              "&lt;body&gt;&lt;p" &amp; CSS_p &amp; "&gt;" &amp; Greeting() &amp; _
                              "&lt;/p&gt;" &amp; _
                              "&lt;p" &amp; CSS_p &amp; "&gt;   Our records indicate that we have not received signed paperwork for the " &amp; _
                              "following jobs as of yet:&lt;/p&gt;" &amp; _
                              "&lt;table" &amp; CSS_table &amp; "&gt;" &amp; _
                              "&lt;th" &amp; CSS_th &amp; "&gt;Account&lt;/th&gt;" &amp; _
                              "&lt;th" &amp; CSS_th &amp; "&gt;Store Number&lt;/th&gt;" &amp; _
                              "&lt;th" &amp; CSS_th &amp; "&gt;Address&lt;/th&gt;" &amp; _
                              "&lt;th" &amp; CSS_th &amp; "&gt;Work Order#&lt;/th&gt;" &amp; _
                              "&lt;th" &amp; CSS_th &amp; "&gt;Description&lt;/th&gt;" &amp; _
                              "&lt;th" &amp; CSS_th &amp; "&gt;Service Date&lt;/th&gt;" &amp; _
                              job_list &amp; "&lt;/table&gt;" &amp; _
                              "&lt;p" &amp; CSS_p &amp; "&gt;Please remember to submit the work orders, your invoices and checklists (if applicable) for the jobs " &amp; _
                              "referenced above." &amp; _
                              "&lt;p" &amp; CSS_p &amp; "&gt;You may send the paperwork via:&lt;/p&gt;" &amp; _
                              "&lt;ul&gt;&lt;li&gt;Fax to (000) 000 0000 or,&lt;/li&gt;" &amp; _
                              "&lt;li&gt;Email to: xx@xxxxxxxxx.com (please indicate your crew code in the email subject)&lt;/li&gt;&lt;/ul&gt;" &amp; _
                              "&lt;p" &amp; CSS_p &amp; "&gt;All work orders must be signed and stamped by the store manager on duty at the time of service. If the " &amp; _
                              "stamp is not available, please ask the manager to write that on the work order (and checklists if applicable), as well as " &amp; _
                              "initial the note. Submitting un-signed and un-stamped paperwork, that is not properly filled out, may result in your " &amp; _
                              "invoices being rejected.&lt;/p&gt;" &amp; _
                              "&lt;p" &amp; CSS_p &amp; "&gt;Thank you for your cooperation.&lt;/p&gt;" &amp; _
                              HTMLSignature &amp; "&lt;/body&gt;&lt;/html&gt;"
              OutlookEmail SendTo:=email, subject:=email_subject, Message:=email_body, send:=True
  </code></pre>