Skip to content

A Dockerized setup for Postfix, Dovecot, SpamAssassin, and MySQL.

Notifications You must be signed in to change notification settings

BushyToaster88/dockerised-emailserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerized Email Server

A Dockerized setup for Postfix, Dovecot, SpamAssassin, and MySQL with TLS/SSL

Getting Started

Clone the repo and cd into it

git clone https://github.com/BushyToaster88/dockerised-emailserver.git
cd dockerised-emailserver

Build the Dockerfile

docker build -t emailserver-mysql .

To run the container, use the following command:

docker run -d --name emailserver-mysql \
  -p 25:25 \
  -p 993:993 \
  -p 465:465 \
  -p 53:53
  -e MYSQL_ROOT_PASSWORD='PASSWORD' \
  -e DOMAIN='example.com' \
  -e EMAIL_USER='name@example.com' \
  -e EMAIL_PASSWORD='PASSWORD' \
  emailserver-mysql

Once the Docker container is running, execute the setup script with:

docker exec -it emailserver-mysql python3 /app/dns_sendability.py

This command will setup letsencrypt and show you what to put into your DNS.

DNS Configuration

You will need some DNS entries to connect to your email server. First being the MX records. It will be best if you create these 5 MX records so it covers all email clients.

mail.example.com
smtp.example.com
webmail.example.com
imap.example.com
mx.example.com

This is an example MX record image

Letsencrypt requires a CNAME record.

CNAME 19-05-2024_09-46-33-PM_screenshot

If you plan to send emails, you need to configure other records. Note that for sending emails to major email providers such as Gmail, a rDNS (Reverse DNS) record must also be configured. If you do not want to send emails, you can ignore the below DNS settings. Remove all quotes when copying.

DMARC Record (TXT) image

SPF Record (TXT) image

DKIM Record (TXT) image

The dkim record may have a space in it, just remove that image

Adding users

Run the python script to add more users to your email server.

docker exec -it mailserver python3 /app/add_user.py user@example.com password

About

A Dockerized setup for Postfix, Dovecot, SpamAssassin, and MySQL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published