Files
GibSend/apps/smtp-server/src/usage.js
Harsh Shrikant Bhat 1e66222425 docs: Added SMTP docs (#58)
* Added SMTP docs

* Added Nodemailer example

* Change port in example
2024-08-21 14:20:31 +10:00

31 lines
788 B
JavaScript

const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
host: "smtp.unsend.dev",
port: 2587,
secure: false,
auth: {
user: "unsend",
pass: "us_123",
},
tls: {
rejectUnauthorized: false,
},
});
const mailOptions = {
to: "sender@example.com",
from: "hello@example.com",
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);
} else {
console.log("Email sent successfully:", info.response);
}
});