1

Im trying to add some css style to my email template but seems like when it shows in the inbox of the user, seems like the css is off.

function email() {

  var html = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">'
  html += 'Hello,<br> Hey click on the link to verify your email.<br>';
  html += "<a type='button' class='btn btn-primary btn-lg' href='http://localhost:3000/hello'";

  return html;

}

Email code

   var transporter = nodemailer.createTransport(smtpTransport({
  service: 'gmail',
  host : 'smtp.gmail.com',
  secureConnection : true,
  auth : {
    user: 'auth',
    pass: 'abc123'
  }
}));


mailOptions = {
  to : 'user',
  subject : "Please confirm your Email account",
  html : email()
}

transporter.sendMail(mailOptions, function(error, response) {
  if(error){
    console.log(error);

  }else{
    console.log("Message sent: " + response);

  }
});

The css is not shown, did i do anything wrong?

sinusGob
  • 4,053
  • 12
  • 46
  • 82

1 Answers1

2

you cannot send or pass pure css class's in email you need to use an inline package, or inlining your css

Nathan
  • 39
  • 7