const nodemailer = require("nodemailer"); router.sendMail = (req, res) => { const stmpconfig = { host: "smtpAddress", port: "465", secure: true, auth: { user: "abc@def.com", pass: "123456" } }; const from = "발신자명 < abc@def.com >"; const to = "수신자 이메일 주소"; const subject = "제목"; const html = "<p>내용</p>"; let mailOptions = { from, to, subject, html }; const transporter = nodemailer.createTransport(stmpconfig); transporter.verify((err, success) => { if (err) console.error(err); console.log("Your config is correct / " + success); }); transporter.sendMail(mailOptions, function(err, res) { if (err) { console.error("🤕 NodeMailer test failed with error:\n", err); } else { console.log("this is a new password: " + password); console.log("📬 Successfully sent NodeMailer test with result:\n", res); } }); transporter.close; res.send("it's over"); };


+ Recent posts