aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/nodemailer/process-nodemailer-fixture.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/third_party/nodemailer/process-nodemailer-fixture.js')
-rw-r--r--test/js/third_party/nodemailer/process-nodemailer-fixture.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/js/third_party/nodemailer/process-nodemailer-fixture.js b/test/js/third_party/nodemailer/process-nodemailer-fixture.js
new file mode 100644
index 000000000..a54735f26
--- /dev/null
+++ b/test/js/third_party/nodemailer/process-nodemailer-fixture.js
@@ -0,0 +1,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();