How do I get the html that I should send in emails?

424 views Asked by At

I have just started using Zurb Foundation (SASS) to create responsive emails. I followed this tutorial to create a test email. As seen in the tutorial, when viewing the test email in the browser it is responsive and looks beautiful.

The standard boiler plate I use for the test email:

<!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" lang="en" xml:lang="en">
  <head>
    <link rel="stylesheet" type="text/css" href="{{root}}css/app.css">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width">
    <title>{{subject}}</title>
    <!-- <style> -->
  </head>
  <body>
    <span class="preheader">{{description}}</span>
    <table class="body">
      <tr>
        <td class="center" align="center" valign="top">
          <center>
            {{> body}}
          </center>
        </td>
      </tr>
    </table>
    <!-- prevent Gmail on iOS font size manipulation -->
   <div style="display:none; white-space:nowrap; font:15px courier; line-height:0;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
  </body>
</html>

The body of the test email:

---
layout: index-layout
subject: My Email Templates
---
<container>

  <row class="gray collapse">
    <columns>
      <center><img src="http://unsplash.it/800/200"></center>
    </columns>
  </row>

  <row class="gray">
    <columns>
      <h2 class="text-center">Responsive columns below</h2>
    </columns>
  </row>
  <row class="gray">
    <columns small="12" large="4">
      <p>Column 1</p>
    </columns small="12" large="4">
        <columns>
      <p>Column 2</p>
    </columns small="12" large="4">
        <columns>
      <p>Column 3</p>
    </columns>
  </row>
</container>

This is what the resulting source looks like taken from "view source" in Chrome:

<!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" lang="en" xml:lang="en">
<head>
  <link rel="stylesheet" type="text/css" href="css/app.css">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width">
  <title>My Email Templates</title>
  <!-- <style> -->
</head>
<body><script id="__bs_script__">//<![CDATA[
    document.write("<script async src='/browser-sync/browser-sync-client.js?v=2.23.6'><\/script>".replace("HOST", location.hostname));
//]]></script>

  <span class="preheader"></span>
  <table class="body">
    <tr>
      <td class="center" align="center" valign="top">
        <center data-parsed="">

            <table align="center" class="container float-center"><tbody><tr><td>

              <table class="row gray collapse"><tbody><tr>
                <th class="small-12 large-12 columns first last"><table><tr><th>
                  <center data-parsed=""><img src="http://unsplash.it/800/200" align="center" class="float-center"></center>
                </th>
<th class="expander"></th></tr></table></th>
              </tr></tbody></table>

              <table class="row gray"><tbody><tr>
                <th class="small-12 large-12 columns first last"><table><tr><th>
                  <h2 class="text-center">Responsive columns below</h2>
                </th>
<th class="expander"></th></tr></table></th>
              </tr></tbody></table>
              <table class="row gray"><tbody><tr>
                <th class="small-12 large-4 columns first"><table><tr><th>
                  <p>Column 1</p>
                </th></tr></table></th>
                    <th class="small-12 large-4 columns"><table><tr><th>
                  <p>Column 2</p>
                </th></tr></table></th>
                    <th class="small-12 large-4 columns last"><table><tr><th>
                  <p>Column 3</p>
                </th></tr></table></th>
              </tr></tbody></table>


            </td></tr></tbody></table>

        </center>
      </td>
    </tr>
  </table>
  <!-- prevent Gmail on iOS font size manipulation -->
  <div style="display:none; white-space:nowrap; font:15px courier; line-height:0;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</body>
</html>

I sent the test email to myself using gmail to check it. This was done by copying the source shown above and pasting it using "Insert HTML" through the html extension for gmail in chrome. The result was horrible - no responsiveness and it looked ugly.

How am I supposed to make use of the test email that I have created? Is it even the source from "view source" in Chrome that I should send in an email? Is it even possible to send the test email over gmail, or do I have to use e.g., mailchimp or sendgrid?

2

There are 2 answers

0
gj-wes On

Putsmail will be your best bet for quickly testing a single template like this. You can just paste your complied HTML in and add your gmail address (or any others)

3
gwally On

The SASS version of Zurb Foundation for Email 2.0 is controlled using terminal emulator. I am assuming you have already installed Zurb using one. The thing you are missing is a few commands.

To start, you use the terminal to navigate to the directory where you installed Zurb. The command is npm start or foundation watch. This will start Zurb running in a mode where you can see your edits before it runs a command to inline the code.

To inline the code, type foundation build or npm run build. This will give you an email which has the necessary css code inline where needed to produce the final email.

Zurb Commands

A few other Zurb commands you might find useful are:

  • npm install --global foundation-cli - (Install npm)
  • foundation new --framework emails - (a new installation of zurb)
  • npm start - (start the application)
  • foundation watch - (start the application)
  • foundation build - (run an inliner for the appropriate css)
  • npm run build - (run an inliner for the appropriate css)
  • npm cache clean - (clear the cache)
  • npm update - (install latest updates)

If none of this makes sense, please visit one of the following for better tutorials to hopefully get you up to speed on how Zurb works. It's complicated, but it makes great emails.

More Information

Good luck.