fix security issues with smtp

This commit is contained in:
KMKoushik
2024-08-12 09:27:42 +10:00
parent 7c2ced6ee5
commit 15645683eb
6 changed files with 188 additions and 103 deletions

View File

@@ -1,37 +1,30 @@
const nodemailer = require('nodemailer');
const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
host: "localhost",
port: 2587,
secure: false,
auth: {
user: "unsend",
pass: "us_38de56vwa7_cc90a91b01a402de0c15516b3554adc1",
},
tls: {
rejectUnauthorized: false,
}
});
host: "localhost",
port: 2587,
secure: false,
auth: {
user: "unsend",
pass: "us_38de56vwa7_cc90a91b01a402de0c15516b3554adc1",
},
tls: {
rejectUnauthorized: false,
},
});
const mailOptions = {
to: "harsh121102@gmail.com",
from: "hello@support.harshbhat.me",
subject: "Testing SMTP",
html: "<strong>THIS IS USING SMTP,</strong><p>Unsend is the best open source sending platform<p><p>check out <a href='https://unsend.dev'>unsend.dev</a>",
text: "hello,\n\nUnsend is the best open source sending platform",
to: "harsh121102@gmail.com",
from: "hello@support.harshbhat.me",
subject: "Testing SMTP",
html: "<strong>THIS IS USING SMTP,</strong><p>Unsend is the best open source sending platform<p><p>check out <a href='https://unsend.dev'>unsend.dev</a>",
text: "hello,\n\nUnsend is the best open source sending platform",
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.error('Error sending email:', error);
console.error("Error sending email:", error);
} else {
console.log('Email sent successfully:', info.response);
console.log("Email sent successfully:", info.response);
}
});