-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail-test.js
More file actions
35 lines (30 loc) · 1.04 KB
/
mail-test.js
File metadata and controls
35 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// mail-test.js
import nodemailer from "nodemailer";
import dotenv from "dotenv";
dotenv.config(); // loads EMAIL_USER and EMAIL_PASS from .env
async function sendTest() {
try {
const transporter = nodemailer.createTransport({
host: "smtp.protonmail.ch",
port: 587,
secure: false, // use STARTTLS
auth: {
user: process.env.EMAIL_USER, // accounts@catci.net
pass: process.env.EMAIL_PASS, // your ProtonMail app password
},
});
const info = await transporter.sendMail({
from: '"Catci SMTP Test" <accounts@catci.net>',
to: "a@catci.net",
subject: "Test Email from Catci Server",
text: "Hello! This is a test message confirming that ProtonMail SMTP works.",
html: "<p>Hello! ✅<br>This is a <b>Catci SMTP test</b> using ProtonMail.<br>If you see this, it worked!</p>",
});
console.log("Message sent successfully!");
console.log("Message ID:", info.messageId);
} catch (err) {
console.error("Failed to send email:");
console.error(err);
}
}
sendTest();