aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/nodemailer/process-nodemailer-fixture.js
blob: a54735f26db0dc0eb1a7a6d3b5e96fd203a83f67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import nodemailer from "nodemailer";
const account = await nodemailer.createTestAccount();
const transporter = nodemailer.createTransport({
  host: account.smtp.host,
  port: account.smtp.port,
  secure: account.smtp.secure,
  auth: {
    user: account.user, // generated ethereal user
    pass: account.pass, // generated ethereal password
  },
});

// send mail with defined transport object
let info = await transporter.sendMail({
  from: '"Fred Foo 👻" <foo@example.com>', // sender address
  to: "example@gmail.com", // list of receivers
  subject: "Hello ✔", // Subject line
  text: "Hello world?", // plain text body
  html: "<b>Hello world?</b>", // html body
});
const url = nodemailer.getTestMessageUrl(info);
console.log(typeof url === "string" && url.length > 0);
transporter.close();