From 79d3ff2d9cd643f02105256a7eb081ece6c67c58 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 4 Apr 2023 17:17:12 +0100 Subject: [PATCH] Finalise register mail templates --- mail-templates/register.html | 27 +++++++++++++++++------ mail-templates/register.txt | 6 ++++++ src/services/mail.services.js | 40 ++++++++++++++++++++++++----------- 3 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 mail-templates/register.txt diff --git a/mail-templates/register.html b/mail-templates/register.html index 72a2425..27a9776 100644 --- a/mail-templates/register.html +++ b/mail-templates/register.html @@ -1,14 +1,20 @@ OwlBoard - Register + - +

+
@@ -17,15 +23,22 @@

Register for OwlBoard

-

Use the link below to register for OwlBoard (Staff Version)

- Register
-

The registration will apply only to the device you click this link on, - you can use the same email address to register on other devices but you will - need a separate registration link. +

Use the link below to register for OwlBoard (Staff Version)

+
+ Register +


+

Alternatively visit owlboard.info/reg and paste in your access code:

+

>>ACCESSCODE<<

+

This registration is for one device only, you can register again using the + same email address for other devices and access OwlBoard from both. +

+

If you did not request to sign up to OwlBoard (Staff Version), you can + safely ignore this email.

+
\ No newline at end of file diff --git a/mail-templates/register.txt b/mail-templates/register.txt new file mode 100644 index 0000000..5a0a5e8 --- /dev/null +++ b/mail-templates/register.txt @@ -0,0 +1,6 @@ +Complete your OwlBoard (Staff) Registration using the link below. + +https://owlboard.info/ref/auto.html?>>ACCESSCODE<< + +Alternatively visit https://owlboard.info/ref/ and paste in your access code: +>>ACCESSCODE<< \ No newline at end of file diff --git a/src/services/mail.services.js b/src/services/mail.services.js index 8eacc2b..1d2e436 100644 --- a/src/services/mail.services.js +++ b/src/services/mail.services.js @@ -7,24 +7,21 @@ const smtpUser = process.env.OWL_EML_USER const smtpPass = process.env.OWL_EML_PASS const smtpHost = process.env.OWL_EML_HOST const smtpPort = process.env.OWL_EML_PORT -// The 'secure' option is set to false as the SMTP server used only supports STARTTLS and will not accept TLS or no encryption -const options = { +let transporter = mail.createTransport({ host: smtpHost, port: smtpPort, - secure: false, + secure: false, // Must be false for STARTTLS on port 587 auth: { user: smtpUser, pass: smtpPass } -} - -let transporter = mail.createTransport(options) +}) async function sendTest(to, cc, bcc) { log.out(`mailServices.sendTest: Sending test message to: ${to}`, "info") - let tHtml = fs.readFile('mail-templates/test.html', 'utf-8'); - let tTxt = fs.readFile('mail-templates/test.txt', 'ascii') + let tHtml = fs.readFile('mail-templates/register.html', 'utf-8'); + let tTxt = fs.readFile('mail-templates/register.txt', 'utf-8'); // Send test mail message try { var res = await transporter.sendMail({ @@ -33,8 +30,8 @@ async function sendTest(to, cc, bcc) { cc: cc, bcc: bcc, subject: "Test Message from OwlBoard", - text: await tTxt, - html: await tHtml + text: (await tTxt).replace(/>>ACCESSCODE<>ACCESSCODE<>ACCESSCODE<>ACCESSCODE<