Sending template email with nodemailer, broken styles












0















trying to send a template email using nodemailer and making the template with handlebars.



The email does send but the styling of the email is not right. It looks like this



enter image description here



I have attached what I've written in my handlebars template



<!DOCTYPE html>
<html>
<head>
<title>Welcome to</title>
<style>
@import url('https://fonts.googleapis.com/css?family=Cabin');
body { margin: 0; padding: 0; left: 0; top: 0; background-color: white; }
h1 { font-family: 'Cabin'; font-weight: 600; color: rgba(5,45,84,1); margin-left: 2px;}
p { font-family: 'Cabin'; font-weight: 400; font-size: 11pt; color: rgba(5,45,84,1); margin-left: 2px; }
h3 {
margin-top: 50px;
color: rgba(5,45,84,.25);
font-family: 'Cabin';
font-weight: 400;
font-size: 10pt;
width: 80vw;
}
h2 {
text-align: center;
margin-top: 25px;
margin-bottom: 10px;
color: rgba(5,45,84,1);
font-family: 'Cabin';
font-weight: 400;
font-size: 10pt;
}
h3 > a { color: rgba(118,146,255,1); }
h3 > a:hover { cursor: pointer; }
h3 > a:active { opacity: .75; }
.page-container { width: 80vw; margin-left: 10vw; }
.logo { margin-left: 2px; height: 30px; margin-top: 20px; margin-bottom: 20px; }
.divider { height: 1px; width: 100%; background-color: rgba(5,45,84,.1); margin-bottom: 40px; }
.button-container {
width: 100%;
height: 50px;
margin-top: 25px;
margin-bottom: 25px;
display: flex;
flex-direction: column;
}
.cta {
transition: all 200ms;
-webkit-transition: all 200ms;
-moz-transition: all 200ms;
-o-transition: all 200ms;
-ms-transition: all 200ms;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 46px;
color: white;
font-size: 11pt;
font-family: 'Cabin';
font-weight: 500;
padding-left: 20px;
padding-right: 20px;
background-color: #7692FF;
border-radius: 5px;
margin-top: 0px;
margin-bottom: 4px;
box-shadow: 0px 4px rgba(118,146,255,.25);
}
.cta:hover {
cursor: pointer;
}
.cta:active {
margin-top: 4px;
margin-bottom: 0px;
box-shadow: 0px 0px rgba(118,146,255,.25);
}
.footer-container {
width: 100%;
margin-top: 50px;
padding-bottom: 10px;
background-color: rgba(5,45,84,.04);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
</style>
</head>
<body>
<div class="page-container">
<div class="divider"></div>
<h1>Welcome to</h1>
<p>
Hi Matthew, thanks for signing up for. We're so happy to have you! almost ready to join your first group. Click the link below to verify your email.
</p>
<div class="button-container">
<div class="cta">
GET STARTED
</div>
</div>
<p>
We'll reach out again when we're ready for you to start using. Just reply to this email if you have any questions.
</p>
<p>
- Team Something
</p>
</div>
<div class="footer-container">
<h3 class="footer">
If you need help, respond to this message. If this message was sent to you by mistake and you did not sign up for an account with us, we apologize.
</h3>
<h2>a9 Something 2018</h2>
</div>
</body>
</html>


It seems to me that there are certain styles that don't apply, the imported font from google, the centering of the word on the button and the box shadow. Does flex work with handlebars??










share|improve this question



























    0















    trying to send a template email using nodemailer and making the template with handlebars.



    The email does send but the styling of the email is not right. It looks like this



    enter image description here



    I have attached what I've written in my handlebars template



    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to</title>
    <style>
    @import url('https://fonts.googleapis.com/css?family=Cabin');
    body { margin: 0; padding: 0; left: 0; top: 0; background-color: white; }
    h1 { font-family: 'Cabin'; font-weight: 600; color: rgba(5,45,84,1); margin-left: 2px;}
    p { font-family: 'Cabin'; font-weight: 400; font-size: 11pt; color: rgba(5,45,84,1); margin-left: 2px; }
    h3 {
    margin-top: 50px;
    color: rgba(5,45,84,.25);
    font-family: 'Cabin';
    font-weight: 400;
    font-size: 10pt;
    width: 80vw;
    }
    h2 {
    text-align: center;
    margin-top: 25px;
    margin-bottom: 10px;
    color: rgba(5,45,84,1);
    font-family: 'Cabin';
    font-weight: 400;
    font-size: 10pt;
    }
    h3 > a { color: rgba(118,146,255,1); }
    h3 > a:hover { cursor: pointer; }
    h3 > a:active { opacity: .75; }
    .page-container { width: 80vw; margin-left: 10vw; }
    .logo { margin-left: 2px; height: 30px; margin-top: 20px; margin-bottom: 20px; }
    .divider { height: 1px; width: 100%; background-color: rgba(5,45,84,.1); margin-bottom: 40px; }
    .button-container {
    width: 100%;
    height: 50px;
    margin-top: 25px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    }
    .cta {
    transition: all 200ms;
    -webkit-transition: all 200ms;
    -moz-transition: all 200ms;
    -o-transition: all 200ms;
    -ms-transition: all 200ms;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 46px;
    color: white;
    font-size: 11pt;
    font-family: 'Cabin';
    font-weight: 500;
    padding-left: 20px;
    padding-right: 20px;
    background-color: #7692FF;
    border-radius: 5px;
    margin-top: 0px;
    margin-bottom: 4px;
    box-shadow: 0px 4px rgba(118,146,255,.25);
    }
    .cta:hover {
    cursor: pointer;
    }
    .cta:active {
    margin-top: 4px;
    margin-bottom: 0px;
    box-shadow: 0px 0px rgba(118,146,255,.25);
    }
    .footer-container {
    width: 100%;
    margin-top: 50px;
    padding-bottom: 10px;
    background-color: rgba(5,45,84,.04);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    }
    </style>
    </head>
    <body>
    <div class="page-container">
    <div class="divider"></div>
    <h1>Welcome to</h1>
    <p>
    Hi Matthew, thanks for signing up for. We're so happy to have you! almost ready to join your first group. Click the link below to verify your email.
    </p>
    <div class="button-container">
    <div class="cta">
    GET STARTED
    </div>
    </div>
    <p>
    We'll reach out again when we're ready for you to start using. Just reply to this email if you have any questions.
    </p>
    <p>
    - Team Something
    </p>
    </div>
    <div class="footer-container">
    <h3 class="footer">
    If you need help, respond to this message. If this message was sent to you by mistake and you did not sign up for an account with us, we apologize.
    </h3>
    <h2>a9 Something 2018</h2>
    </div>
    </body>
    </html>


    It seems to me that there are certain styles that don't apply, the imported font from google, the centering of the word on the button and the box shadow. Does flex work with handlebars??










    share|improve this question

























      0












      0








      0








      trying to send a template email using nodemailer and making the template with handlebars.



      The email does send but the styling of the email is not right. It looks like this



      enter image description here



      I have attached what I've written in my handlebars template



      <!DOCTYPE html>
      <html>
      <head>
      <title>Welcome to</title>
      <style>
      @import url('https://fonts.googleapis.com/css?family=Cabin');
      body { margin: 0; padding: 0; left: 0; top: 0; background-color: white; }
      h1 { font-family: 'Cabin'; font-weight: 600; color: rgba(5,45,84,1); margin-left: 2px;}
      p { font-family: 'Cabin'; font-weight: 400; font-size: 11pt; color: rgba(5,45,84,1); margin-left: 2px; }
      h3 {
      margin-top: 50px;
      color: rgba(5,45,84,.25);
      font-family: 'Cabin';
      font-weight: 400;
      font-size: 10pt;
      width: 80vw;
      }
      h2 {
      text-align: center;
      margin-top: 25px;
      margin-bottom: 10px;
      color: rgba(5,45,84,1);
      font-family: 'Cabin';
      font-weight: 400;
      font-size: 10pt;
      }
      h3 > a { color: rgba(118,146,255,1); }
      h3 > a:hover { cursor: pointer; }
      h3 > a:active { opacity: .75; }
      .page-container { width: 80vw; margin-left: 10vw; }
      .logo { margin-left: 2px; height: 30px; margin-top: 20px; margin-bottom: 20px; }
      .divider { height: 1px; width: 100%; background-color: rgba(5,45,84,.1); margin-bottom: 40px; }
      .button-container {
      width: 100%;
      height: 50px;
      margin-top: 25px;
      margin-bottom: 25px;
      display: flex;
      flex-direction: column;
      }
      .cta {
      transition: all 200ms;
      -webkit-transition: all 200ms;
      -moz-transition: all 200ms;
      -o-transition: all 200ms;
      -ms-transition: all 200ms;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      height: 46px;
      color: white;
      font-size: 11pt;
      font-family: 'Cabin';
      font-weight: 500;
      padding-left: 20px;
      padding-right: 20px;
      background-color: #7692FF;
      border-radius: 5px;
      margin-top: 0px;
      margin-bottom: 4px;
      box-shadow: 0px 4px rgba(118,146,255,.25);
      }
      .cta:hover {
      cursor: pointer;
      }
      .cta:active {
      margin-top: 4px;
      margin-bottom: 0px;
      box-shadow: 0px 0px rgba(118,146,255,.25);
      }
      .footer-container {
      width: 100%;
      margin-top: 50px;
      padding-bottom: 10px;
      background-color: rgba(5,45,84,.04);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      }
      </style>
      </head>
      <body>
      <div class="page-container">
      <div class="divider"></div>
      <h1>Welcome to</h1>
      <p>
      Hi Matthew, thanks for signing up for. We're so happy to have you! almost ready to join your first group. Click the link below to verify your email.
      </p>
      <div class="button-container">
      <div class="cta">
      GET STARTED
      </div>
      </div>
      <p>
      We'll reach out again when we're ready for you to start using. Just reply to this email if you have any questions.
      </p>
      <p>
      - Team Something
      </p>
      </div>
      <div class="footer-container">
      <h3 class="footer">
      If you need help, respond to this message. If this message was sent to you by mistake and you did not sign up for an account with us, we apologize.
      </h3>
      <h2>a9 Something 2018</h2>
      </div>
      </body>
      </html>


      It seems to me that there are certain styles that don't apply, the imported font from google, the centering of the word on the button and the box shadow. Does flex work with handlebars??










      share|improve this question














      trying to send a template email using nodemailer and making the template with handlebars.



      The email does send but the styling of the email is not right. It looks like this



      enter image description here



      I have attached what I've written in my handlebars template



      <!DOCTYPE html>
      <html>
      <head>
      <title>Welcome to</title>
      <style>
      @import url('https://fonts.googleapis.com/css?family=Cabin');
      body { margin: 0; padding: 0; left: 0; top: 0; background-color: white; }
      h1 { font-family: 'Cabin'; font-weight: 600; color: rgba(5,45,84,1); margin-left: 2px;}
      p { font-family: 'Cabin'; font-weight: 400; font-size: 11pt; color: rgba(5,45,84,1); margin-left: 2px; }
      h3 {
      margin-top: 50px;
      color: rgba(5,45,84,.25);
      font-family: 'Cabin';
      font-weight: 400;
      font-size: 10pt;
      width: 80vw;
      }
      h2 {
      text-align: center;
      margin-top: 25px;
      margin-bottom: 10px;
      color: rgba(5,45,84,1);
      font-family: 'Cabin';
      font-weight: 400;
      font-size: 10pt;
      }
      h3 > a { color: rgba(118,146,255,1); }
      h3 > a:hover { cursor: pointer; }
      h3 > a:active { opacity: .75; }
      .page-container { width: 80vw; margin-left: 10vw; }
      .logo { margin-left: 2px; height: 30px; margin-top: 20px; margin-bottom: 20px; }
      .divider { height: 1px; width: 100%; background-color: rgba(5,45,84,.1); margin-bottom: 40px; }
      .button-container {
      width: 100%;
      height: 50px;
      margin-top: 25px;
      margin-bottom: 25px;
      display: flex;
      flex-direction: column;
      }
      .cta {
      transition: all 200ms;
      -webkit-transition: all 200ms;
      -moz-transition: all 200ms;
      -o-transition: all 200ms;
      -ms-transition: all 200ms;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      height: 46px;
      color: white;
      font-size: 11pt;
      font-family: 'Cabin';
      font-weight: 500;
      padding-left: 20px;
      padding-right: 20px;
      background-color: #7692FF;
      border-radius: 5px;
      margin-top: 0px;
      margin-bottom: 4px;
      box-shadow: 0px 4px rgba(118,146,255,.25);
      }
      .cta:hover {
      cursor: pointer;
      }
      .cta:active {
      margin-top: 4px;
      margin-bottom: 0px;
      box-shadow: 0px 0px rgba(118,146,255,.25);
      }
      .footer-container {
      width: 100%;
      margin-top: 50px;
      padding-bottom: 10px;
      background-color: rgba(5,45,84,.04);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      }
      </style>
      </head>
      <body>
      <div class="page-container">
      <div class="divider"></div>
      <h1>Welcome to</h1>
      <p>
      Hi Matthew, thanks for signing up for. We're so happy to have you! almost ready to join your first group. Click the link below to verify your email.
      </p>
      <div class="button-container">
      <div class="cta">
      GET STARTED
      </div>
      </div>
      <p>
      We'll reach out again when we're ready for you to start using. Just reply to this email if you have any questions.
      </p>
      <p>
      - Team Something
      </p>
      </div>
      <div class="footer-container">
      <h3 class="footer">
      If you need help, respond to this message. If this message was sent to you by mistake and you did not sign up for an account with us, we apologize.
      </h3>
      <h2>a9 Something 2018</h2>
      </div>
      </body>
      </html>


      It seems to me that there are certain styles that don't apply, the imported font from google, the centering of the word on the button and the box shadow. Does flex work with handlebars??







      html handlebars.js nodemailer express-handlebars






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 19:37









      Shaun ChuaShaun Chua

      10011




      10011
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Email clients are notorious for display issues. It is always recommended to use nested tables, and some basic elements, but mostly tables.



          Use inline styling, and keep it as basic as you can. Most of HTML5 won't be fully supported.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452155%2fsending-template-email-with-nodemailer-broken-styles%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Email clients are notorious for display issues. It is always recommended to use nested tables, and some basic elements, but mostly tables.



            Use inline styling, and keep it as basic as you can. Most of HTML5 won't be fully supported.






            share|improve this answer




























              0














              Email clients are notorious for display issues. It is always recommended to use nested tables, and some basic elements, but mostly tables.



              Use inline styling, and keep it as basic as you can. Most of HTML5 won't be fully supported.






              share|improve this answer


























                0












                0








                0







                Email clients are notorious for display issues. It is always recommended to use nested tables, and some basic elements, but mostly tables.



                Use inline styling, and keep it as basic as you can. Most of HTML5 won't be fully supported.






                share|improve this answer













                Email clients are notorious for display issues. It is always recommended to use nested tables, and some basic elements, but mostly tables.



                Use inline styling, and keep it as basic as you can. Most of HTML5 won't be fully supported.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 '18 at 20:02









                MariusMarius

                867




                867






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452155%2fsending-template-email-with-nodemailer-broken-styles%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Berounka

                    Sphinx de Gizeh

                    Different font size/position of beamer's navigation symbols template's content depending on regular/plain...