javascript 电子邮件节点任务 Posted 2021-05-03
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 电子邮件节点任务相关的知识,希望对你有一定的参考价值。
const nodeMailer = require("nodemailer");
const emailFunk = (req, res) => {
let transporter = nodeMailer.createTransport({
host: 'smtp.mailtrap.io',
port: 2525,
auth: {
user: "f283d3f1b0f398",
pass: "cfc2c788fb8128"
}
});
let mailOptions = {
from: "baeoverbay@gmail.com", // Expediteur
to: "supergrandma@yopmail.com", // Destinataires
subject: "Cookies recipe", // Sujet
text: "Grandma I need to borrow your cookie cutter", // plaintext body
html: "<b>Grandma I <em>need</em> to borrow your cookie cutter</b>" // html body
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
return console.log({error: error, request: req.body});
}
console.log('Message %s sent: %s', info.messageId, info.response);
});
res.end()
};
module.exports = emailFunk;
const express = require('express');
const router = express.Router();
const emailFunk = require('./askForCookiesRecipe');
router.post('/askForCookiesRecipe', emailFunk);
module.exports = router;
9. let cookiesRouter = require('./routes/cookies');
25. app.use(cookiesRouter);
// add this between app.use(/users, ...) and app.use(function(req, res, next) {next(createError(404));});
以上是关于javascript 电子邮件节点任务的主要内容,如果未能解决你的问题,请参考以下文章
javascript 电子邮件SMTP节点JS
javascript 使用节点中的jxa测试抓取到期任务
用于在节点 js javascript 文件中发送用户消息的 gmail API
javascript-删除节点
jBPM 4.3 任务通知标签被忽略
在 Java 代码中来一段 JavaScript?聊聊 Flowable 中的脚本任务