This playbook deploy docker-mailserver to your Debian GNU/Linux box. It's complete solution you need to self-host your own mailserver. I use it myself.
docker_mailserver_domainname: "example.com"
docker_mailserver_hostname: "mail"
email: "example@example.com"
email_password: "changeme"
certbot_certs:
- email: "{{ email }}"
domains:
- "{{ docker_mailserver_hostname }}.{{ docker_mailserver_domainname }}"
You need to create some DNS records first.
- Create
A
andAAAA
records which points to your server. - Create DMARC record: type
TXT
, name_dmarc
, valuev=DMARC1; p=none
- Create SPF record: type
TXT
, name@
, value:v=spf1 mx -all
- Create MX record: type
MX
, name@
, value: yours server hostname.
After that, you can run playbook. There is another one DNS record you should create: DKIM. Find it's content in /etc/docker-mailserver/opendkim/keys/{{ domainname }}/{{ hostname }}.txt
Also you should create reverse DNS record pointing to your mailserver domain.