Repository navigation
v0.38.0
A development mailbox: under tug dev, with no MAIL_HOST, the mail an app sends is kept in a mailbox the app shows at /_tug/mail, each mail as a mail program would show it, where it was written out to the terminal as text alone: who it's from and to, its subject, and its text, with the link that verifies an email to copy out of the log. Its HTML, which a person's mail program shows, wasn't seen, nor its files, nor the message a mail server would take. Phoenix keeps its app's mail at /dev/mailbox, and Laravel's Sail and Herd run Mailpit beside the app: tug's mailbox needs nothing beside it.
Registering in an app made by tug new -auth, run as tug dev runs it, puts one line in its log:
mail, kept in the mailbox (MAIL_HOST isn't set): "Verify your email for blog" to ann@example.com: http://localhost:8080/_tug/mail/01M3XFRBZWEBFY0J00VADJQB31
and the mail's page has, as text, its frame of HTML aside, and its boundary cut short:
← Mailbox
Mail · Fri 2 Oct, 12:00:26
Verify your email for blog
HEADERS
To <ann@example.com>
Subject Verify your email for blog
Date Fri, 02 Oct 2026 12:00:26 +0700
Message-ID <YR2FDDMSODUU6PMX6YJEWC2CFP@localhost>
MIME-Version 1.0
Content-Type multipart/alternative; boundary=225c68997f…
HTML
[the mail's HTML, as a mail program shows it, its button opening the link in a tab of its own]
TEXT
Hi Ann Lee,
Follow this link to verify that ann@example.com is yours, and it's where blog will reach you.
Verify my email:
http://localhost:8080/verify-email/1/tmbf8q.Cvw-CkVU76YLr9ofgz1YSA
The link works for a day. If you didn't make an account, someone typed your email by mistake: there's nothing to do.
blog
SOURCE
The message as a mail server takes it
What's new:
- A mailbox under tug dev: with no
MAIL_HOST,mail.FromEnvreturns amail.Mailboxundertug dev, which setsTUG_DEV. It keeps each mail asSMTPwould send it, in.tug/mail, which git leaves out, the newest 100, and writes a line to the log for each: whom it's to,Bcctoo, its subject, and its link, atAPP_URL. WithoutTUG_DEV, as a deploy and a test run, mail is written out byLog, as before. - The mailbox's pages:
/_tug/mail, which the App answers underConfig.DevTools, before its own middleware and routes, as it does the endpoints of Inertia's DevTools: the mail, newest first, and each mail's page, with its headers, itsBcc, which no header has, its HTML, its text, its links each a link, its files, to download, and its source. They run no script, and a reload shows the mail that came since. - The HTML in a sandboxed frame: nothing in a mail runs, and its links open in a tab of their own, as the link that verifies an email does, into the app, in the browser the developer is logged in with.
mail.Mailbox: a Mailer, asLogis, for an app that makes its own:Dir,.tug/mailby default, where the App reads it;URL, the app's address, for the links; andW, the log, the standard error by default. It refuses whatSMTPwould, but for a mail with noFrom.- The guide: Accounts, the mail while developing, and package mail's
Mailbox; CLI, whatTUG_DEVturns on; Deployment,MAIL_HOSTandTUG_DEV; Getting started; and the README.
Upgrading: nothing an app calls changed: go get github.com/cuonggt/tug@v0.38.0. An app that takes its mailer from mail.FromEnv, as one made by tug new -auth does, keeps its mail in the mailbox under tug dev from then on, with no change of its own, and its log has a line for each mail where it had the mail. A deploy, the app's tests, and anything run without TUG_DEV write mail out as before, and MAIL_HOST still sends it, under tug dev too, as to a Mailpit.
The guide is in docs/. tug needs Go 1.26.