mirror of
https://github.com/runyanjake/olomana.git
synced 2026-06-25 08:04:52 -07:00
1.9 KiB
1.9 KiB
Mail Server
A dockerized mail server for PWS. For now I am using Stalwart.
Setup
- Port forward the following ports:
- 25/TCP - SMTP, mandatory for receiving mail. May need to open a support ticket to open this port or live with partial nonfunction.
- 465 - SMTPS, implicit TLS.
- 587 - SMTP, alternative, possibly blocked by ISPs.
- 993 - IMAPS, mandatory for reading mail from apps.
- 443 - HTTPS, mandatory for the management dashboard and modern JMAP.
- DNS Records (Basic)
- A,
Host=mail, v=YOUR_IP - MX,
Host=@, v=mail.example.com - CNAME,
em123.example.com -> sendgrid.net - CNAME,
s1._domainkey.example.com - CNAME,
s2._domainkey.example.com
- DNS Records (Security)
- TXT (DKIM),
Host=@, v=spf1 mx include:sendgrid.net -all. - TXT (DMARC),
Host=_dmarc, v=DMARC1; p=quarantine; rua=mailto:admin@example.com, Tells people what to do if SPF/DKIM fails.
- Configure Sendgrid/Get API Key
- We are NOT setting a PTR record because I am on a residential internet connection.
- Set up a SendGrid account.
- Go to
Settings > API Keysand create a key withFull AccessandMail Sendpermissions. Copy the key. - Go to
Settings > Sender Authenticationand complete Sender Authentication steps to link your domain to SendGrid so they can send your mail.
- Create Relay Host in Stalwart (
Settings > SMTP > Outbound > Relay Hosts)
Description: SendGrid RelayAddress: smtp.sendgrid.netPort: 587Protocol: SMTPAuthentication: Username: apikey, Secret: <YOUR_SENDGRID_API_KEY>.
- Set Routing Rule in Stalwart (`Settings > SMTP > Outbound > Routing')
- Create or Edit the routing strategy:
[
{ "if": "is_local_domain('', rcpt_domain)", "then": "local" },
{ "else": "SendGrid Relay" }
]
- Start via Docker
docker compose up -d
- Test Use Mail-Tester.com to test.