Skip to content
Writing
DenoTypeScriptDevToolsRuntime

Deno 2.0 Transactional Email Guide: Native TypeScript Runtime

Deno 2.0 simplifies backend development with native TypeScript support and zero package.json bloat. Learn how to send transactional emails cleanly.

Tayyab MughalFounder & AI Chief1 min read

Native TypeScript without compilation config

Deno 2.0 runs TypeScript files out of the box with zero build step, zero Babel/Webpack configuration, and built-in security permissions.

Complete Deno 2.0 Email Server (server.ts)

Using the web-standard Deno.serve API, spin up an instant transactional email dispatch worker.

TYPESCRIPT
Deno.serve(async (req: Request) => {
  if (req.method !== 'POST') {
    return new Response('Method Not Allowed', { status: 405 });
  }

  const { to, subject, message } = await req.json();
  const apiKey = Deno.env.get('SADASEND_API_KEY');

  const res = await fetch('https://api.sadasend.com/v1/emails', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ to, subject, text: message }),
  });

  const data = await res.json();
  return Response.json(data, { status: res.status });
});

Running with explicit network permissions

Deno requires explicit permission flags: deno run --allow-net=api.sadasend.com,0.0.0.0 --allow-env server.ts

Early Access

Building AI agents that send email?

Join the SadaSend early access waitlist to get scoped API keys, recipient allowlists, and Model Context Protocol (MCP) servers upon launch.

Rolling out in developer batches·No credit card needed