如何在node.js上使用邮戳?

我是node.js的新手,无法弄清楚如何在node.js中引用js库postmark.js。

var POSTMARK_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxx"; var postmark = require("postmark")(POSTMARK_KEY); postmark.send({ "From": from, "To": to, "Subject": subject, "TextBody": emailBody }, function (err, to) { if (err) { console.log(err); return; } console.log("Email sent to: %s", to); }); 

我试过上面的代码,但不知道如何使用postmark.js

是否有任何简单的方法来使用js中的html模板有html电子邮件function?

您可以使用“HtmlBody”字段通过邮戳发送HTML邮件:

  postmark.send({ "From": from, "To": to, "Subject": subject, "TextBody": emailBody, "HtmlBody": "<h1>hellow</h1>" }, function (err, to) { if (err) { console.log(err); return; } console.log("Email sent to: %s", to); });