Hiển thị các bài đăng có nhãn nodemailer. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn nodemailer. Hiển thị tất cả bài đăng

Sending multiple emails at once with nodemailer

 https://stackoverflow.com/questions/64412815/sending-multiple-emails-at-once-with-nodemailer


 static async resendUndeliveredMails() {
try {
  const mails = await findAll();
  const mailerPromises = mails.map((mail) => transporter.sendMail(mail.dataValues));
  const responses = await Promise.all(mailerPromises);
  console.log(responses, "All Mails Have Been Sent Successfully");
} catch (e) {
  console.log(e);
}

const nodemailer = require("nodemailer");

const transporter = nodemailer.createTransport({
  service: "gmail",
  auth: {
    user: "user",
    pass: "pass", // naturally, replace both with your real credentials or an application-specific password
  },
});

const mailOptions = {
  from: "user@gmail.com",
  to: "test@gmail.com",
  subject: "testing due",
  text: "Dudes, we really need your money.",
};

const mailOptions2 = {
  from: "user@gmail.com",
  to: "test1@gmail.com",
  subject: "LOL due",
  text: "Dudes, we really need your money.",
};

Promise.all([
  transporter.sendMail(mailOptions),
  transporter.sendMail(mailOptions2),
])
  .then((res) => console.log(res))
  .catch((err) => console.log(err));

Sending an email using NodeMailer & Gmail

Source: https://codeburst.io/sending-an-email-using-nodemailer-gmail-7cfa0712a799

inside your node.js file write
var transporter = nodemailer.createTransport({
 service: 'gmail',
 auth: {
        user: 'youremail@address.com',
        pass: 'yourpassword'
    }
});
We used gmail as our transport service.

anti-pattern là gì

  Trong công nghệ và lập trình, Anti-pattern (mẫu phản diện) là những giải pháp bề ngoài có vẻ hiệu quả để giải quyết một vấn đề phổ biến, ...