Envello
Tutorial

Sending transactional email from Deno

Envello Team·2026-07-17·4 min read

Deno ships fetch globally, so sending a transactional email is a plain HTTP call with zero dependencies. The one Deno-specific thing worth knowing up front: network access is permission-gated, so a script that wasn't written with this in mind will fail with a permission error the first time it tries to reach Envello's API.

The call

  • const apiKey = Deno.env.get('ENVELLO_API_KEY');
  • const res = await fetch('https://api.envello.dev/emails', { method: 'POST', headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ from, to, subject, html }) });
  • if (!res.ok) throw new Error(`Envello send failed: ${res.status}`);

Permissions

Run the script with --allow-net=api.envello.dev --allow-env=ENVELLO_API_KEY rather than a blanket --allow-all. Scoping network access to the specific host you're calling, rather than granting it broadly, is a small habit that costs nothing and limits what a compromised dependency could reach if one ever tried to make an unexpected outbound call.

Where this fits in a Deno project

Whether you're running a Deno server (Oak, Fresh, or the built-in Deno.serve), a scheduled Deno Deploy cron job, or a standalone script, the fetch call above is identical. Deno doesn't need a build step or transpilation for this, TypeScript works directly, which keeps the integration to the handful of lines above with nothing else to configure.

Envello

EU-hosted transactional email, done right by default.