Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

Simple function to provide the Email sending capability. The internal is limited to the Pro version only.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import nodemailer from "npm:nodemailer";
const transport = nodemailer.createTransport({
host: "sandbox.smtp.mailtrap.io",
port: 2525,
auth: {
user: Deno.env.get("email_user"),
pass: Deno.env.get("email_pass"),
},
});
const options = {
from: "you@example.com",
};
export function sendMail(to, subject, html) {
transport.sendMail({ ...options, to, subject, html });
console.log(`email sent to ${to}`);
}
April 12, 2024