Fri May 12 08:07:00 UTC 2023 inscode

上级 ca207a2f
console.log("欢迎来到 InsCode");
\ No newline at end of file
function sendMail() {
const nodemailer = require('nodemailer');
// 创建传输器对象
let transporter = nodemailer.createTransport({
service: 'gmail', // 选择电子邮件提供程序
auth: {
user: 'your_email@gmail.com', // 发件人的电子邮件地址
pass: 'your_password' // 发件人的电子邮件密码
}
});
// 设置电子邮件内容
let mailOptions = {
from: 'your_email@gmail.com', // 发件人的电子邮件地址
to: 'recipient_email@gmail.com', // 收件人的电子邮件地址
subject: 'Hello from Node.js!', // 电子邮件主题
text: 'Hello World!' // 电子邮件正文
};
// 发送电子邮件
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
}
\ No newline at end of file
......@@ -4,15 +4,15 @@
"description": "",
"main": "index.js",
"scripts": {
"dev": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
"dev": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@types/node": "^18.0.6",
"node-fetch": "^3.2.6"
"@types/node": "^18.0.6",
"node-fetch": "^3.2.6",
"nodemailer": "^6.9.2"
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册