DEV Community

Ryuichiro Toyoshi
Ryuichiro Toyoshi

Posted on

I kept setting up SPF/DKIM/DMARC just to email myself

I kept setting up SPF, DKIM, and DMARC just to email myself.

To drop a contact-form alert or a cron failure into your own inbox, you don't need a
sending domain or a delivery provider. inbox-beam writes the message straight into a
mailbox you control with the IMAP APPEND command. Nothing is sent.

★ Star on GitHub ·
npm


How it works

Skip the entire delivery pipeline. Append directly to the mailbox.

The usual way
  Your app → SMTP / SES → SPF · DKIM · DMARC → deliverability → Inbox

With inbox-beam
  Your app → IMAP APPEND → Your inbox
Enter fullscreen mode Exit fullscreen mode

APPEND is a standard IMAP command (RFC 9051) for writing a message into a mailbox — the
same mechanism your client uses to save sent mail and drafts. The message lands unread and
searchable. No SPF check, no bounce, no third party.


Use the right tool

inbox-beam is a notification sink for mailboxes you own — not an email service.

✅ Good for ❌ Not for
Contact-form notifications Emailing users or customers
Cron / batch failure alerts Transactional or marketing email
Admin-only app events Anything needing an audit trail
Small internal tools & personal SaaS Third-party delivery of any kind
Error logs you want in your inbox

This is not email delivery. inbox-beam appends to a mailbox you already control. It does
not send mail and cannot reach anyone else. It keeps no send log, and the timestamp is set by
the client — so don't use it where an audit trail matters.


One idea, three languages

Authenticate over IMAP, build a message, append it. That's the whole thing.

Node / TypeScript — npm: inbox-beam

// npm install inbox-beam
import { InboxBeam } from "inbox-beam";

const beam = new InboxBeam({
  host: "imap.gmail.com",
  auth: { user: "you@example.com", pass: process.env.IMAP_APP_PASSWORD },
});

await beam.beam({ subject: "New contact", text: "someone submitted the form" });
Enter fullscreen mode Exit fullscreen mode

Ruby / Rails — gem: inbox_beam

# gem install inbox_beam
require "inbox_beam"

beam = InboxBeam.new(
  host: "imap.gmail.com",
  user: "you@example.com",
  pass: ENV["IMAP_APP_PASSWORD"]
)

beam.beam(subject: "New contact", text: "someone submitted the form")
Enter fullscreen mode Exit fullscreen mode

Or register it as an ActionMailer delivery method and your existing deliver_later calls land
in your inbox instead of going out via SMTP.

Python — stdlib: imaplib

import imaplib, email.message

msg = email.message.EmailMessage()
msg["Subject"] = "Cron failed"
msg.set_content("backup job failed")

m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login("you@example.com", IMAP_APP_PASSWORD)
m.append("INBOX", "", None, msg.as_bytes())
Enter fullscreen mode Exit fullscreen mode

About credentials

The honest part most "just use IMAP" posts skip.

  • Use a provider app password (e.g. Gmail App Passwords), never your real account password.
  • The blast radius is bounded: a leaked credential can read and write your own mailbox — it cannot send mail as you to others.
  • Keep it in an environment variable / secret store, the same as any API key.
  • Consider a dedicated mailbox, label, or filter so notifications stay tidy and revocable.

inbox-beam — write notifications into a mailbox you control. MIT licensed. Not an email delivery service.

Top comments (0)