Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to get HTML formatting to work in GMAIL

I have a powershell script that sends out an HTML formatted email, the formatting looks perfect in Outlook but does not work in GMAIL, any suggestions? The HTML used is:

#HTML 
$a = "<style>"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 10px;border-style: solid;border-color: black;}"
$a = $a + "TD{border-width: 1px;padding: 10px;border-style: solid;border-color: black;}"
$a = $a + "</style>"

Thanks.

like image 884
Charlotte Avatar asked Feb 09 '12 10:02

Charlotte


People also ask

Does Gmail block HTML emails?

Gmail removes your entire <style> block if it encounters an error. Gmail strips HTML formatting entirely if it encounters even one error.

Does Gmail recognize HTML?

Gmail only supports <style> in the <head> . Gmail does support embedded styles ( <style> ). However, embedded styles are only supported in the head of your HTML document. The Gmail Android and iOS apps does not support <style> at all when rendering emails retrieved through non-Google accounts (GANGA).


1 Answers

GMail tends to prefer inline styles. As such:

<table style="border: 1px solid black; border-style: collapse;">
     <tr style="border: 1px solid black; padding: 10px;">
          <td style="border: 1px solid black; padding: 10px;">
          </td>
     </tr>
</table>
like image 93
user1324288 Avatar answered Nov 25 '22 10:11

user1324288