TeaNode · Documentation · Source

Getting started

This walks through standing up a mail server for one domain, from nothing to mail arriving and being forwarded. It takes about twenty minutes, most of it waiting for DNS.

Before you begin

You need three things:

The port 25 problem

Read this before you rent a host. Most consumer ISPs, and a good number of cloud providers, block outbound port 25 by default — DigitalOcean, Google Cloud, Azure and Oracle Cloud all do, and Amazon EC2 does until you ask.

Inbound port 25 is usually fine. Outbound is what gets blocked, and without it this server can receive mail and cannot deliver it — so forwarding fails while everything looks healthy.

Check before you commit:

nc -vz gmail-smtp-in.l.google.com 25

If that hangs or is refused, you have three options: ask the provider to lift the block, pick one that does not have it, or set smtp.socks5Proxy to route outbound mail through a host that can reach port 25.

1. Install

curl -L -o /usr/local/bin/teanode-server \
  https://github.com/ziyan/teanode/releases/latest/download/teanode-server-linux-amd64
curl -L -o /usr/local/bin/teanode \
  https://github.com/ziyan/teanode/releases/latest/download/teanode-linux-amd64
chmod +x /usr/local/bin/teanode-server /usr/local/bin/teanode

teanode-server is the server, with the dashboard inside it, so there is nothing else to install or serve. teanode is the client that administers it, and belongs on the server and on your own machine; there is a macOS build of it.

There is a container image too, with both binaries in it, and that is the better way to run this: see reference/deployment.md, which replaces steps 1 and 2 here. The rest of this page — DNS, claiming the dashboard — applies either way.

2. Describe the server

Configuration lives in PostgreSQL. The environment says how to reach it, and — the first time the server starts against an empty one — what kind of server to create.

mkdir -p /opt/teanode && cd /opt/teanode
teanode-server config env --output .env \
  --hostname mail.example.com \
  --domain example.com

--hostname is the name of this server. It is what the server announces in SMTP and what your MX record will point at, so it must be a name you can add a DNS record for.

--domain is the domain whose mail you want to receive. It becomes the first domain this server serves.

Open .env and set TEANODE_DATABASE_URL to your PostgreSQL, and TEANODE_TLS_ACME_EMAIL to an address the certificate authority can warn about expiry. Then set the database up:

set -a; . ./.env; set +a
teanode-server config init

That runs the migrations and stores the configuration. It generates a DKIM signing key for the domain and a server secret, both of which live in the database from now on — so the database is the thing to back up.

After this the .env is only read for where the database is: settings change in the dashboard, and the server logs any first-run variable that disagrees with what is stored.

Moving an existing server in

If this deployment already ran on a teanode.yaml, load it instead of creating something new. Identifiers, signing keys, the server secret and the session key all come across unchanged, so stored mail still resolves, SMTP passwords still work, and nobody is signed out:

teanode-server config import --file /opt/teanode/teanode.yaml

3. Publish DNS

Ask the server what to publish:

teanode dkim show example.com

You need four records. The first is the only one that decides whether mail arrives at all; the rest decide whether it is trusted.

Type Name Value
A mail.example.com your server's address
MX example.com 10 mail.example.com
TXT example.com v=spf1 mx -all
TXT teanode1._domainkey.example.com what dkim show printed

A word on each:

Once mail is flowing, add a fifth:

TXT   _dmarc.example.com   v=DMARC1; p=none; rua=mailto:rua@mail.example.com

p=none asks nobody to reject anything; it only asks for reports, which the server parses and shows you. Move to p=quarantine and then p=reject once the reports show your own mail passing.

4. Check and start

teanode-server config validate
teanode-server run

On the first start the server obtains a certificate over HTTP-01, which needs port 80 reachable from the internet. If it is not, that is the first thing the log will tell you.

Upgrading a container that used to run as root

The image runs as uid 65532 now, not root, with only CAP_NET_BIND_SERVICE to bind the low ports. If your data directory was created by an earlier version it is owned by root, and the server will fail to read it. Once, before starting the new image:

chown -R 65532:65532 /opt/teanode/data/teanode

5. Claim the dashboard

Open https://mail.example.com/. The first visitor creates the only account, so do this immediately — before the server has been reachable long enough for anybody else to find it. If you would rather not race:

teanode user add you

The dashboard lists exactly which DNS records are still missing or wrong, per domain, so you can see what is left rather than guessing. It checks periodically; there is no need to reload it.

If you are locked out

There is no password reset by mail; the server's own host is the way back in. On it, with the server's environment in the shell — which a container already has — the client reaches the server as the console and can add an account or set a password:

teanode user create you
teanode user password you

docker compose exec teanode teanode user create you      # in a container

When the server is not running, or is running but nobody can sign in and the console cannot reach it either, teanode-server user edits the stored configuration directly and needs only the database:

teanode-server user list
teanode-server user add you
teanode-server user password you

teanode-server user reset removes every account, after which the next visitor to the dashboard creates one, as on the first day. Anyone who can reach the dashboard can claim it until somebody does, so do not leave it in that state.

The account you make this way is an administrator with a mailbox of its own, called Personal. The web UI opens on it: the folders in the rail, a folder's messages beside the one being read. The management pages — every message the server handled, the queue, reports, domains, the server itself — are under /manage, behind Manage at the foot of the rail, and Back to mailbox at the top brings you back. Your own settings, the mailbox's among them, are under /settings, behind your name at the foot of the rail.

The Inbox and Starred, every flagged message wherever it sits, stay at the top of the rail; hover any other folder for a pin that puts it up beside them. The search box looks in the open folder, or in the whole mailbox with sender, recipient, subject, date and attachment filters behind More. Contacts, kept from whoever you write to, have a page of their own in the rail, beside the calendar, what your agent knows and your finances.

6. Give the mailbox an address

A mailbox receives nothing until an address points at it. On the domain's Aliases tab, add one with the kind Deliver into a mailbox and pick yours: the pattern ^you$ makes you@example.com yours. The same tab is where hello@example.com forwards elsewhere, so a domain can do both.

7. Send yourself something

Send a message to you@example.com from an account elsewhere. Within a few seconds it is in your Inbox, unread, with the count in the rail and in the tab's title. Open it, and Reply: the reply leaves from you@example.com, signed with the domain's key, and a copy sits in Sent.

A message to hello@example.com shows up in the management side's mail list instead, with SPF, DKIM and DMARC verdicts for the sender and a delivery attempt to the address you set as --forward-to.

If it does not arrive, the queue page says why. The usual causes, in order of how often they are the answer:

  1. The MX record has not propagated yet. Check with dig MX example.com.
  2. Port 25 is not reachable inbound. Check from elsewhere with nc -vz mail.example.com 25.
  3. The forwarding destination rejected it, in which case the queue shows the remote server's own words.

8. Read it in a mail program

Mail programs speak IMAP, which the server serves on port 993 once listen.imaps is set — the compose file publishes it, and the server settings page's Listeners tab is where it is turned on for a server that predates it. A program signs in with your address and an app password: make one on Mailbox settings → Mail programs, name it for the device, and type the password shown into the program. It is shown once. The same tab lists what the program will ask for — the incoming server, the outgoing server on port 587, and the username — and most programs find those on their own from the address.

9. Bring the people you share it with

If others use this server, a household or a few friends, put them in a circle. Open Circles from the account menu at the foot of the rail, make one called what it is (Family, say), and add the people. Someone who already has an account is invited by username and joins when they accept. Someone who has none is added with Make an account for someone: give a username, a name and a first password, and they are in the circle at once, with nothing to accept. They sign in with that username and password and can change the password themselves under Settings → Change password. On the command line a circle is made with teanode circle create --kind family Family (--kind is required: family, friends or colleagues), and the account is one step: teanode user create --circle <circle-id> personb prompts for the first password, and --stdin reads it from standard input instead (teanode user create --stdin --circle <circle-id> personb). That command takes only a username; the name other people see is set afterwards with teanode user update personb --name "Person B", and until then they see the username.

Once you share a circle with someone you can message each other. Chats are in the agent's drawer: start one with New conversation, beside its search box, then Message someone. Every circle has a chat of its own.

Where to go next

Documentation

Getting started

Running it

Security

Contributing

Every document is also plain markdown, listed in /llms.txt.