import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";
const client = new SmtpClient();
await client.connect({
hostname: "smtp.163.com",
port: 25,
username: "username",
password: "password",
});
await client.send({
from: "[email protected]",
to: "[email protected]",
subject: "Mail Title",
content: "Mail Content",
html: "<a href='https://github.com'>Github</a>",
});
await client.close();
await client.connectTLS({
hostname: "smtp.163.com",
port: 465,
username: "username",
password: "password",
});
await client.connectTLS({
hostname: "smtp.gmail.com",
port: 465,
username: "your username",
password: "your password",
});
await client.send({
from: "[email protected]", // Your Email address
to: "[email protected]", // Email address of the destination
subject: "Mail Title",
content: "Mail Content,maybe HTML",
});
await client.close();
You can pass options to your client through the SmtpClient
constructor.
import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";
//Defaults
const client = new SmtpClient({
content_encoding: "quoted-printable", // 7bit, 8bit, base64, binary, quoted-printable
});