Search... Ctrl + K

Send Email (smtp)
One script reply has been approved by the moderators Verified

Created by admin 107 days ago Used 74 times 0 Points

Send an email using smtp

No comments yet

Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.13.0/index.ts";
import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";

export async function main(smtp_res: wmill.Resource<"smtp">, to_email: string, from_email: string, subject: string, content: string) {

  const client = new SmtpClient(smtp_res);

  const connectConfig: any = client;
  await client.connectTLS(client);

  await client.send({
    from: from_email,
    to: to_email,
    subject: subject,
    content: content,
  });

  await client.close();
  return `Email sent from ${from_email} to ${to_email}`;
}

Submitted by admin 107 days ago

Edited 107 days ago

No comments yet