sriio / deno-smtp

SMTP implements for deno

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deno SMTP mail client

Build Status GitHub GitHub release (Deno)

Example

import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";

const client = new SmtpClient();

await client.connect({
  host: "smtp.163.com",
  port: 25,
  username: "username",
  password: "password",
});

await client.send({
  from: "mailaddress@163.com",
  to: "to-address@xx.com",
  subject: "Mail Title",
  content: "Mail Content,maybe HTML",
});

await client.close();

TLS connection

await client.connectTLS({
  host: "smtp.163.com",
  port: 465,
  username: "username",
  password: "password",
});

Use in Gmail

await client.connectTLS({
  host: "smtp.gmail.com",
  port: 465,
  username: "your username",
  password: "your password",
});

await client.send({
  from: "someone@163.com", // Your Email address
  to: "someone@xx.com", // Email address of the destination
  subject: "Mail Title",
  content: "Mail Content,maybe HTML",
});

await client.close();

About

SMTP implements for deno

License:MIT License


Languages

Language:TypeScript 100.0%