{"slug": "one-liner-install-self-hosting-email-solution", "title": "One liner install self hosting email solution", "summary": "BearMail, a one-shot install mail and calendar stack for startups in the AI-agent era, provides a self-hosted email solution on a Linux x86-64 server with systemd, using Stalwart as the mail engine and offering SMTP, IMAP, JMAP, webmail, and calendar via Caddy HTTPS. The installer, run via curl, requires a name.com domain and an SMTP relay account (Brevo or Mailjet) to handle outbound delivery when cloud providers block port 25. The product targets AI agents needing a real inbox and APIs without relying on consumer Gmail accounts.", "body_md": "BearMail is a **one-shot install** mail and calendar stack for startups in the\nAI-agent era: your company domain, a real inbox, and APIs that agents can use\nwithout handing mail to a consumer Gmail account.\n\nOne Linux server, one interactive `install.sh`\n\n. When it finishes you have:\n\n- mail on\n`mail.example.com`\n\n(SMTP, IMAP, JMAP, admin); - webmail and calendar on\n`https://webmail.example.com`\n\n; - HTTPS via Caddy;\n- outbound delivery through Brevo (Mailjet is also available) so it works when the cloud provider blocks port 25;\n- DNS published through name.com.\n\nThe mail engine is [Stalwart](https://stalw.art). BearMail is the product\nwrapper: artifacts, two systemd services, Caddy, an SMTP relay, and name.com\nin one flow.\n\nOn a Linux **x86-64** server with systemd, from an SSH session:\n\n```\ncurl -fsSL https://raw.githubusercontent.com/luoxiprovo/bearmail/main/release_install.sh | sudo bash\n```\n\nThat downloads `install.sh`\n\n, the `stalwart`\n\nbinary, and\n`stalwart-webui.tar.gz`\n\nfrom this GitHub repo, then starts the interactive\nsetup. Prepare the [name.com](#1-namecom-domain-and-account) and\n[SMTP relay](#2-smtp-relay-account-brevo-recommended) accounts first. The\nwizard will ask for them.\n\nPreview the download plan without changing the system:\n\n```\ncurl -fsSL https://raw.githubusercontent.com/luoxiprovo/bearmail/main/release_install.sh | sh -s -- --dry-run\n```\n\nDo this **before** you run the installer. The script will ask for the values;\nit does not create the vendor accounts for you.\n\n- Buy or transfer a domain at\n[name.com](https://www.name.com/). - Keep the domain on\n**name.com nameservers**. - Sign in and open\n**Account Settings → API Tokens**. - Create a\n**production** API token. Two-step verification must allow API access. - Keep the\n**account username** and the**token** ready. The installer types the token with echo off and does not save it in`installer-state.json`\n\n.\n\nYou will also choose two hostnames in that zone, typically:\n\n| Hostname | Role |\n|---|---|\n`mail.example.com` |\nMail server, admin, MX, IMAP/SMTP |\n`webmail.example.com` |\nBearMail web app |\n\nThey may share one public IP. They cannot be the same name.\n\nCloud VMs (including Google Cloud) usually **block outbound TCP 25**. The\ninstaller asks which relay to use. **Brevo is the default.** Mailjet remains\navailable.\n\n- Create an account at\n[app.brevo.com](https://app.brevo.com/). **Settings → Senders, domains & dedicated IPs**→ add your mail domain (the part after`@`\n\n, such as`example.com`\n\n).- Publish Brevo’s domain-ownership TXT (Brevo code) and DKIM as shown there.\nThe installer can merge\n`include:spf.brevo.com`\n\ninto SPF when it publishes DNS through name.com. Add Brevo’s DKIM selector from the dashboard yourself. **Settings → SMTP & API → SMTP**([SMTP page](https://app.brevo.com/settings/keys/smtp)).- Copy the\n**SMTP login**(username, often`xxx@smtp-brevo.com`\n\n) and the**SMTP key**(password). These are not your Brevo website password, and not a REST API key.\n\nHost is `smtp-relay.brevo.com`\n\n. Port `587`\n\n(STARTTLS) is the default; `465`\n\nis implicit TLS. See [Brevo SMTP relay](/luoxiprovo/bearmail/blob/main/docs/BREVO_SMTP_RELAY.md).\n\n- Create an account at\n[app.mailjet.com](https://app.mailjet.com/). **Account settings → Senders & Domains**→ add your mail domain.- Publish Mailjet’s domain-ownership TXT and DKIM. The installer can merge\n`include:spf.mailjet.com`\n\ninto SPF when it publishes DNS through name.com. **Account settings → SMTP and SEND API settings**([relay page](https://app.mailjet.com/account/relay)).- Copy the\n**API key**(SMTP username) and** secret key**(SMTP password).\n\nHost is `in-v3.mailjet.com`\n\n. See [Mailjet SMTP relay](/luoxiprovo/bearmail/blob/main/docs/MAILJET_SMTP_RELAY.md).\n\n- Linux\n**x86-64** with systemd, root (`sudo`\n\n), and an interactive terminal (SSH is fine). - A public IPv4 address (IPv6 optional).\n- Inbound TCP\n**80** and**443** open if you use automatic Caddy (recommended).\n\nIf you already have the three files on the server, put them in one directory:\n\n```\ninstall.sh\nstalwart\nstalwart-webui.tar.gz\n```\n\nThen run:\n\n```\nsudo sh ./install.sh\n```\n\nBuild them from this repository (community edition, no enterprise feature gates):\n\n```\ncargo build --release --package stalwart --locked --no-default-features \\\n  --features \"sqlite postgres mysql rocks s3 redis azure nats\"\ncp target/release/stalwart ./stalwart\nchmod +x ./stalwart\n\ncd webui\nnpm ci\nnpm test\nnpm run build\ntar -czf ../stalwart-webui.tar.gz \\\n  install.sh server.mjs stalwart-webui.service dist\ncd ..\n```\n\nTo update **only** the WebUI on an already-installed server, copy `update.sh`\n\nand a new `stalwart-webui.tar.gz`\n\nto that host and run `sudo sh ./update.sh`\n\n.\nIt reuses the live WebUI service and `config.json`\n\n. Details:\n[How to install BearMail](/luoxiprovo/bearmail/blob/main/docs/INSTALL.md#update-the-webui-only).\n\nFull paths, reinstall, uninstall, and troubleshooting:\n[How to install BearMail](/luoxiprovo/bearmail/blob/main/docs/INSTALL.md).\n\nPress Enter to accept a value in `[brackets]`\n\n. Invalid answers are explained\nand asked again; they do not abort the install.\n\n**Installation layout**\n\n`1) Standard system paths (recommended)`\n\n— binary in`/usr/local/bin`\n\n, config in`/etc/stalwart`\n\n, data in`/var/lib/stalwart`\n\n.`2) Custom self-contained prefix`\n\n— then it asks for an absolute prefix such as`/opt/stalwart`\n\n. Use this only if you must keep everything under one directory.\n\n**Path to the compiled Stalwart binary**\n\nDefault: `./stalwart`\n\nbeside the script. Must be executable and built from\nthis source (it has to support quick setup).\n\n**Path to the prebuilt WebUI tar archive**\n\nDefault: `./stalwart-webui.tar.gz`\n\n.\n\n**WebUI installation prefix**\n\nDefault: `/opt/stalwart-webui`\n\n. Must not overlap the mail data, config, or\nNode.js paths.\n\n**WebUI local service port**\n\nDefault: `8081`\n\n. Bound to `127.0.0.1`\n\nonly. `8080`\n\nis reserved for the mail\nengine.\n\n**Public WebUI origin**\n\nExact HTTPS URL with no path, for example `https://webmail.example.com`\n\n.\nThis is the URL people and agents open. After you later set the mail domain,\na leftover `webmail.example.com`\n\nexample is replaced with\n`https://webmail.<your-domain>`\n\n.\n\n**HTTPS publishing**\n\n`1) Configure Caddy automatically (recommended)`\n\n— installs Caddy, puts mail and webmail on ports 80/443, obtains Let’s Encrypt certificates, and copies the mail-host cert into the engine for IMAPS/SMTPS. Requires origin on standard port 443. Will not overwrite an operator-owned Caddyfile.`2) Use an existing operator-managed reverse proxy`\n\n— you route`https://webmail…`\n\nto`127.0.0.1:8081`\n\nyourself.\n\n**Installation summary** then **Install both services and run interactive\nserver setup**\n\nDefault is `no`\n\n. Type `yes`\n\nto change the system.\n\nOn a fresh machine the engine then asks:\n\n**Public mail hostname** — example `mail.example.com`\n\n. Not the cloud\nhostname (nothing ending in `.internal`\n\nor `.local`\n\n). Used for MX, TLS, and\nthe URL the web app calls.\n\n**Primary mail domain** — example `example.com`\n\n. The part after `@`\n\n.\n\nPress Enter at **Quick setup** unless you need external Postgres, LDAP,\nOIDC, or another store. Advanced setup exposes every bootstrap field;\nempty input keeps the displayed default.\n\nOn a first internal-directory install, the **administrator username and\npassword are printed once**. Save them before continuing.\n\n**Stalwart administrator username / password**\n\nOnly if this is a reinstall or an external directory. Needed to set CORS\nfor the web origin. Password input is hidden.\n\n**Outbound SMTP relay**\n\nDefault **Brevo**. Choose Mailjet or skip if you can send on TCP 25.\n\n| Prompt (Brevo) | What to enter |\n|---|---|\n| Brevo SMTP host | `smtp-relay.brevo.com` |\n| Brevo SMTP port | `587` or `465` |\n| Brevo SMTP login | SMTP username |\n| Brevo SMTP key | SMTP password (hidden) |\n\nLocal addresses still deliver on the server. Remote recipients go through the selected relay.\n\n**Have you already published the printed forward-DNS records**\n\nDefault **no**. If you answer no, BearMail can publish the table through\nname.com:\n\n| Prompt | What to enter |\n|---|---|\n| name.com domain (DNS zone) | Usually the mail domain, `example.com` |\n| name.com API username | name.com account username |\n| name.com API token | Production token (hidden) |\n\nIf existing records conflict (old A/MX/SPF), the installer lists them and\nasks **Replace the conflicting name.com records** (default yes). Site\nverification TXT and NS records are left alone. Reverse DNS (PTR) is **not**\nin this table; set it at the VPS provider if you send without a relay.\n\nWait for DNS to resolve, then open:\n\n- Admin:\n`https://mail.example.com/admin/`\n\n- BearMail:\n`https://webmail.example.com/`\n\nCreate a user in admin, then sign in to BearMail with that address and\npassword. User guide: [How to sign in and send email](/luoxiprovo/bearmail/blob/main/docs/WEBUI_USER_GUIDE.md).\n\nFinish the selected relay’s domain authentication (Brevo code/DKIM, or Mailjet’s ownership TXT and DKIM) in that vendor’s dashboard if it is still pending.\n\nA BearMail domain is a normal mail system: SMTP to send, IMAP or JMAP to read, CalDAV/JMAP calendars for invites. Point an agent at your hostnames and a mailbox you created—not at a shared consumer inbox.\n\nThe mail engine in this repository is dual-licensed **AGPL-3.0** and the\n[Stalwart Enterprise License](/luoxiprovo/bearmail/blob/main/LICENSES/LicenseRef-SEL.txt). See\n[LICENSES](/luoxiprovo/bearmail/blob/main/LICENSES). Copyright (C) 2020, Stalwart Labs LLC.", "url": "https://wpnews.pro/news/one-liner-install-self-hosting-email-solution", "canonical_source": "https://github.com/luoxiprovo/bearmail", "published_at": "2026-08-26 05:01:51+00:00", "updated_at": "2026-08-26 05:14:27.819216+00:00", "lang": "en", "topics": ["ai-products", "developer-tools"], "entities": ["BearMail", "Stalwart", "Brevo", "Mailjet", "name.com", "Caddy", "Google Cloud"], "alternates": {"html": "https://wpnews.pro/news/one-liner-install-self-hosting-email-solution", "markdown": "https://wpnews.pro/news/one-liner-install-self-hosting-email-solution.md", "text": "https://wpnews.pro/news/one-liner-install-self-hosting-email-solution.txt", "jsonld": "https://wpnews.pro/news/one-liner-install-self-hosting-email-solution.jsonld"}}