I have currently reworked some HTML email templates that I have not done for several years at this depth.
I created my template in an HTML file, which I test locally in a browser, and everything looks fine.
- I use tables for layout
- The only other tags I use are
<p> <a> and <img> - CSS is in the
<style> tag after the <body> tag is opened, but I convert it to inline styles before posting using the MailChimp CSS Inliner Tool . I just put it in a style tag so you can see CSS easier here. In any case, this has nothing to do with a large number of customers for testing purposes.
Now, when I send test emails from my PHP application, I try to get them to contact my email client (s), which looks just like my layout.
The main thing is that I notice that the margin / padding styles seem to be either ignored (e.g. Outlook 2007) or additional add-ons / fields are added in things like <td> , which makes everything softer than I said (e.g. Hotmail).
Example Source
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <body> <style type="text/css"> td {font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#444;} a {color:#056DA5;} p {margin:0; padding:6px 0 6px 0;} .tel {font-weight:bold; color:#056DA5;} #wrapper {padding:10px;} #signoff {padding:18px 0;} #signoff #questions {padding-bottom:18px;} #signature {padding-top:20px; border-top:1px solid #EEE;} #signature td {font-size:12px; color:#777;} #signature #logo {padding-bottom:12px;} #signature #contact p {padding:3px 0 3px 0;} #signature #contact a {text-decoration:none; font-size:13px; font-weight:bold; color:#C00;} #signature #contact .tel {padding-top:6px; color:#777;} #signature #social {padding:20px 0 20px 0;} #signature #social a {margin-right:8px;} #signature #address {font-size:11px; color:#999;} </style> <table id="wrapper" width="100%" bgcolor="#FFFFFF"> <tr> <td> <table> <tr> <td>[CONTENT]</td> </tr> <tr> <td id="signoff"> <p id="questions">If you have any questions, email us at <a href="mailto: support@example.com "> support@example.com </a> or call <span class="tel">01234567890</span>.</p> <p>Thanks,</p> <p>Company</p> </td> </tr> <tr> <td id="signature"> <table cellpadding="0" cellspacing="0"> <tr> <td id="logo" colspan="3"> <img src="http://www.example.com/images/email/logo.gif" alt="Company" /> </td> </tr> <tr> <td id="contact"> <p><a href="http://www.example.com">www.example.com</a></p> <p><a href="mailto: support@example.com "> support@example.com </a></p> <p class="tel">01234567890</p> </td> </tr> <tr> <td id="social"> <a href="https://www.facebook.com/"><img src="http://www.example.com/images/email/facebook.gif" alt="Facebook" /></a> <a href="https://twitter.com/"><img src="http://www.example.com/images/email/twitter.gif" alt="Twitter" /></a> </td> </tr> <tr> <td id="address">Company, address, city, post code</td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html>
Try viewing the HTML in your browser and try emailing it to find out what I mean.
What am I doing wrong, and how can I send an email using the assigned CSS?
source share