From 5792c7cdb8058117a3b424c85ccc7de777c64b94 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 27 Jun 2024 15:23:51 +0100 Subject: [PATCH] Script to verify ethereal --- scripts/verifyEtherealSmtp.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/verifyEtherealSmtp.js diff --git a/scripts/verifyEtherealSmtp.js b/scripts/verifyEtherealSmtp.js new file mode 100644 index 0000000000..aecf1d6593 --- /dev/null +++ b/scripts/verifyEtherealSmtp.js @@ -0,0 +1,31 @@ +const nodemailer = require("nodemailer") + +const options = { + port: 587, + host: "smtp.ethereal.email", + secure: false, + auth: { + user: "seamus99@ethereal.email", + pass: "5ghVteZAqj6jkKJF9R", + }, +} + +const transporter = nodemailer.createTransport(options) +transporter.verify(function (error) { + if (error) { + console.log(error) + } else { + console.log("Ethereal server is ready to take our messages") + } +}) + +const message = { + from: "from@example.com", + to: "to@example.com", + subject: "Did this email arrive?", + html: "Hello World!", +} + +transporter.sendMail(message).then(response => { + console.log("Test email URL: " + nodemailer.getTestMessageUrl(response)) +})