-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.js
More file actions
47 lines (40 loc) · 1.29 KB
/
send.js
File metadata and controls
47 lines (40 loc) · 1.29 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
36
37
38
39
40
41
42
43
44
45
46
47
// Example: sending the built email via SMTP using nodemailer
//
// Install nodemailer first: npm install nodemailer
// Then configure your SMTP settings below.
//
// For ESP-specific sending, replace nodemailer with:
// - SendGrid: @sendgrid/mail
// - Postmark: postmark
// - Mailgun: mailgun-js
// - Amazon SES: @aws-sdk/client-ses
const fs = require("fs");
// Uncomment and install: npm install nodemailer
// const nodemailer = require("nodemailer");
const html = fs.readFileSync("dist/welcome-merged.html", "utf-8");
const text = fs.readFileSync("dist/welcome.txt", "utf-8");
// Configure your SMTP server
const smtpConfig = {
host: "smtp.example.com",
port: 587,
secure: false,
auth: {
user: "your-username",
pass: "your-password",
},
};
async function send() {
// const transport = nodemailer.createTransport(smtpConfig);
// const info = await transport.sendMail({
// from: '"My App" <noreply@example.com>',
// to: "alice@example.com",
// subject: "Welcome!",
// text: text,
// html: html,
// });
// console.log("sent:", info.messageId);
console.log("SMTP config not set — edit send.js with your credentials.");
console.log("HTML length:", html.length, "bytes");
console.log("Text length:", text.length, "bytes");
}
send().catch(console.error);