How to run a mail server on an old Android phone
Run a mail server on an old Android phone with Homedroid and Stalwart. Install the app, answer the Mail setup questions, copy the DNS records and add a mailbox. Check your internet provider’s port-25 restrictions before choosing how mail reaches you.
Before you start
- A domain you can edit DNS for, a running Homedroid server and storage for mail. Phones with 2 GB of RAM or less may struggle.
- A route for incoming mail: a public IP with inbound port 25 available, or a VPS that forwards mail to the phone. For sending, you may need SMTP relay credentials.
How to run a mail server on an old Android phone: step by step
Install Stalwart
Open Modules → Mail server (Stalwart) → Install. The download is about 70 MB and installation needs about 230 MB of disk space before your mail. Setup must finish before it runs.
Answer the Mail setup questions
Open Mail. Enter Domain, Hostname and how mail reaches the phone. Use your public address or the VPS address as appropriate. For a relay, enter its server, port, credentials and SPF include value. Save and allow a few minutes for first startup.
Arrange incoming delivery
For direct or relay sending setups that receive at home, forward public port 25 to the phone’s 2525. If using a VPS, arrange its private forwarding link instead. A sending relay alone does not solve blocked inbound port 25.
Copy the DNS records
Use the Mail page’s copy buttons to add its exact A or CNAME, MX, SPF, DKIM and DMARC values at your DNS provider. Wait for records to propagate; DKIM may be pending until Stalwart starts.
Check the configuration
Select Check. Review DNS, ports, certificate and delivery checks. The check runs from the phone, so also send a message from an outside provider to test incoming delivery.
Add a mailbox and connect a mail app
Add an account on Mail and save its password. Use the client settings the page shows. At home, IMAP uses 9930 with TLS; SMTP submission uses 4650 with TLS or 2587 with STARTTLS. Test sending a reply.
Typical memory and CPU
These are the estimates shown by Homedroid, from its module resource data. Memory is resident process memory; CPU describes use while busy. Actual use depends on the phone and workload.
| Module | Memory | CPU | What affects it |
|---|---|---|---|
| Stalwart | 80–200 MB | low | Spam checks add a little for each message. |
Good to know and troubleshooting
- Keep web admin on port 8825 private, on your LAN or Tailscale. A Cloudflare web tunnel does not replace an incoming SMTP route.
- Stalwart starts with a self-signed certificate. You can paste a certificate and private key obtained elsewhere into Mail; Homedroid does not obtain a trusted certificate itself.
- Back up /var/lib/stalwart inside Alpine while the module is stopped. Mail is received only while the phone is online. Check SPF, DKIM, DMARC and reverse DNS if outgoing mail is rejected.
Read the written guide on GitHub for more detail.