Below I have referenced an example from the NodeMailer package in NodeJS. It is designed to automate email sending. As you can see, in the mailOptions object, you are able to write HTML into the message body. This is an awesome feature that I plan on using.
However, I do have a question on how I might style this HTML. Are there any styling options that I can use on this HTML and how would i go about this. The most logical way I would think would be inline styling.
Has anybody tried this before and had any success?
var nodemailer = require('nodemailer');
// create reusable transporter object using the default SMTP transport
var transporter =
nodemailer.createTransport('smtps://user%40gmail.com:pass@smtp.gmail.com');
// setup e-mail data with unicode symbols
var mailOptions = {
from: '"Fred Foo ?" <foo@blurdybloop.com>', // sender address
to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world ?', // plaintext body
html: '<b>Hello world ?</b>' // html body
};
// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
if(error){
return console.log(error);
}
console.log('Message sent: ' + info.response);
});