All guides

Send Email from Deno

Send emails from Deno with zero config

1. Install the SDK

# No install needed - import from npm

2. Set your API key

Add your SendPigeon API key to your environment variables:

SENDPIGEON_API_KEY=your_api_key_here

Get your API key from the dashboard.

3. Send your first email

import { SendPigeon } from "npm:sendpigeon";

const client = new SendPigeon(Deno.env.get("SENDPIGEON_API_KEY")!);

Deno.serve(async (req) => {
  if (req.method === "POST" && new URL(req.url).pathname === "/contact") {
    const { email, name } = await req.json();

    await client.emails.send({
      from: "hello@yourdomain.com",
      to: email,
      subject: `Thanks for reaching out, ${name}!`,
      html: `<h1>We got your message</h1><p>We'll get back to you soon.</p>`,
    });

    return Response.json({ success: true });
  }

  return new Response("Not found", { status: 404 });
});

Features

  • TypeScript out of the box
  • Secure by default
  • npm compatibility

Ready to send emails?

Get started with 1,000 free emails per month.

Start for free