encodeBase64 (workers/outbound.js)

gitingest_agenticmail_agenticmail · packages/core/src/gateway/workers/outbound.js · javascript · MIT
email

Relays outbound email via SMTP from a Cloudflare Worker, handling TLS, authentication, and raw email construction.

// Source: https://github.com/agenticmail/agenticmail | License: MIT | Copyright 2026 Ope Olatunji
// Provided via justclaw.it.com; keep this notice with the code.
import { connect } from "cloudflare:sockets";

/**
 * AgenticMail Outbound Relay — Cloudflare Worker
 *
 * Relays outbound email through an SMTP server (e.g. Gmail) on port 465.
 * Cloudflare blocks port 25 (direct MX delivery) but allows 465/587.
 * We use Gmail SMTP as the relay — the email FROM is secretary@2sabi.net
 * and Gmail handles the actual delivery with its clean IP infrastructure.
 *
 * Required env vars:
 *   OUTBOUND_SECRET  - shared secret for authenticating HTTP requests
 *   SMTP_HOST        - relay SMTP host (default: smtp.gmail.com)
 *   SMTP_PORT        - relay SMTP port (default: 465)
 *   SMTP_USER        

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key