Search code examples
htmlemailmedia-queriessignature

Responsive HTML E-mail Signature


I'm trying to make a HTML responsive e-mail signature. In all browsers (Chrome, Safari, Firefox etc) it's working fine. But when I send it my Apple Mail (OSX and iOS) won't make it responsive (doesn't scale) :(, and they do support it.

This is my code, can someone help?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Responsive HTML Email Signature</title>
    <style type="text/css">

        /*Global Styles*/
        body { background: #eeeeee; margin: 0; padding: 0; min-width: 100%!important; font-family: 'Proxima Nova','Open Sans','Gill Sans MT','Gill Sans',Corbel,Arial,sans-serif; font-size: 11px; color: #000000; line-height: 17px;}
        a { text-decoration: none; color: #000000;}
        img {height: auto;}
        .content { margin-top: 20px; margin-bottom: 20px; }

        /*Media Queries*/
        @media only screen and (max-width: 751px){
            body { font-size:15px !important; line-height: 21px;}
            .columns{width:100% !important;}
            .columncontainer{display:block !important; width:100% !important;}
            .listitem, .role {font-size: 16px;}
        }
        @media only screen and (min-width: 651px) {
            .content {width: 650px !important;}
        }

    </style>
</head>
<body style="background: aqua;">

    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td>
            <!--[if (gte mso 9)|(IE)]>
              <table width="540" align="center" cellpadding="0" cellspacing="0" border="0">
                <tr>
                  <td>
            <![endif]-->

                <!--Content Wrapper-->
                <table class="content" bgcolor="#ffffff" align="center" cellpadding="0" cellspacing="0" border="0">

                    <!--Signature-->
                    <tr>
                        <td style="padding: 0px 0px 0px 0px; border-top: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;">
                            <table border="0" cellpadding="0" cellspacing="0" width="650" class="columns">
                                <tr valign="top">
                                    <td width="60%" class="columncontainer" style="display:block; width:390px; border-right: 1px solid black; margin-top: 30px">
                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                            <tr>
                                                <td valign="top" style="padding: 30px 30px 30px 30px;"><a href="https://www.studioneonlight.com/"><img width="100%" src="https://www.studioneonlight.com/logo.png" /></a></td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td width="40%" class="columncontainer">
                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                            <tr>
                                                <td valign="top" style="padding: 30px 30px 30px 30px;">
                                                    <table border="0" cellspacing="0" cellpadding="0">
                                                        <tr style="font-weight: bold;">
                                                            <td width="100%" colspan="2">
                                                                Address
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="line-height: 10px;">
                                                                &nbsp;
                                                            </td>
                                                        </tr>
                                                            <tr>
                                                                <td width="40%" style="font-weight: bold;">telefoon</td>
                                                                <td width="60%"><a href="tel:00000">phone number</a></td>
                                                            </tr>
                                                            <tr>
                                                                <td width="40%" style="font-weight: bold;">e-mail</td>
                                                                <td width="60%"><a href="mailto:[email protected]">[email protected]</a></td>
                                                            </tr>
                                                            <tr>
                                                                <td width="40%" style="font-weight: bold;">website</td>
                                                                <td width="60%"><a href="https://www.studioneonlight.com">studioneonlight.com</a></td>
                                                            </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>

                    <!--Legal-->
                    <tr>
                        <td style="padding: 10px 30px 30px 30px;">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="center" style="font-family: sans-serif; font-size: 13px; color: #ccc; padding: 20px 0 0 0;">
                                        WARNING: I cannot be help responsible for the contents of the message above, as apparently my cats have learned how to type.
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>

                </table>

                <!--[if (gte mso 9)|(IE)]>
                      </td>
                    </tr>
                  </table>
                <![endif]-->
            </td>
        </tr>
    </table>
</body>


Solution

  • This might help but from what I understand in Apple Mail, the html page should not have html,head or body tags. This signature page should only include inline css, and basic html elements such as <div>, <span>, <img>, and the such. Perhaps this could be one of the problems the mail clients not interpreting the html signature as you like on OS X and iOS.

    A great code example and template you can use is A responsive html email signature template. This is a GitHub project and haves great instructions on how to use it. Hopefully this helps you out. I would probably compare what you have to the template. The reason, is to make an html signature cross browser and mail application supported, you need to make sure you handle all of the edge cases for each mail client and browser. Another tip is you should be able to use html/css code to detect if the browser is safari and handle the iOS/OS X edge case. Take a look at the Github Project and that should help you out.