import { SMTPHandler } from "https://deno.land/x/denomailer@1.3.0/client/mod.ts";
SMTP-Client with support for pool, etc.
const client = new SMTPClient({
connection: {
hostname: "smtp.example.com",
port: 465,
tls: true,
auth: {
username: "example",
password: "password",
},
},
});
await client.send({
from: "me@example.com",
to: "you@example.com",
subject: "example",
content: "...",
html: "<p>...</p>",
});
await client.close();
Constructors
new
SMTPHandler(config: ClientOptions)create a new SMTPClient
const client = new SMTPClient({
connection: {
hostname: "smtp.example.com",
port: 465,
tls: true,
auth: {
username: "example",
password: "password",
},
},
pool: {
size: 2,
timeout: 60000
},
client: {
warning: 'log',
preprocessors: [filterBurnerMails]
},
debug: {
log: false,
allowUnsecure: false,
encodeLB: false,
noStartTLS: false
}
});
Methods
close(): void | Promise<void>
Closes the connection (kills all Worker / closes connection)
send(config: SendConfig): Promise<void>
Sends a E-Mail with the correspondig config.
client.send({
to: 'abc@example.com',
cc: [
'abc@example.com',
'abc <abc@example.com>',
{
name: 'abc',
mail: 'abc@example.com'
}
],
bcc: {
abc: 'abc@example.com',
other: 'abc@example.com'
},
from: 'me <abc@example.com>',
replyTo: '<abc@example.com>',
subject: 'example',
content: 'auto',
html: '<p>Hello World</p>',
internalTag: 'newsletter',
priority: 'low'
})