Skip to content

Instantly share code, notes, and snippets.

@WebSofter
Last active December 31, 2021 09:18
Show Gist options
  • Save WebSofter/0704af4d9312b1cd18cc7205f4af3552 to your computer and use it in GitHub Desktop.
Save WebSofter/0704af4d9312b1cd18cc7205f4af3552 to your computer and use it in GitHub Desktop.
Mailu configuration for SMTP implementation

Instruction

1. Domain settings

Before you must have domain and setting it:

Type Host Value
A mail Your IP address
MX @ mail.yourdomain.com 10

Next, you have to set the hostname $ hostnamectl set-hostname mail.yourdomain.com

Also, set fully qualified domain name (FQDN). For that edit /etc/hosts file $ apt install nano -y
$ nano /etc/hosts

Now, add the line to this file as follows. Don’t forget to replace 123.15.116.167 with your server IP. Just in case if there’s line starting with your IP address is already present make sure following text is present as well or edit it.

$ YOUR_IP mail.yourdomain.com mail

Next add firewall rules
$ sudo ufw allow 25,80,443,110,143,465,587,993,995/tcp

2. Install docker

...

3. Generating scripts

Generate own docker configuration from https://setup.mailu.io/

4. Docker up SMTP

Up server on VPS/VDS $ docker-compose -p mailu up -d

5. Other helpfull commands

docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
docker-compose down --rmi all
docker-compose -p mailu up -d
docker-compose -p mailu exec admin flask mailu admin admin inlearn.in secret

apt install net-tools
netstat -nlp | grep 443
kill PID

Conclusion

For more information please read post by link https://inguide.in/mailu-docker-compose-setup-build-self-hosted-mail-server/

# This file is auto-generated by the Mailu configuration wizard.
# Please read the documentation before attempting any change.
# Generated for compose flavor
version: '2.2'
services:
# External dependencies
redis:
image: redis:alpine
restart: always
volumes:
- "/mailu/redis:/data"
# Core services
front:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
logging:
driver: json-file
ports:
- "80.87.193.58:80:80" #Admin panel without SSL
- "::1:80:80"
- "80.87.193.58:443:443" #Admin panel with SSL
- "::1:443:443"
- "80.87.193.58:25:25" #SMTP relay Port
- "::1:25:25"
- "80.87.193.58:465:465" #Implicit SSL/TLS Port
- "::1:465:465"
- "80.87.193.58:587:587" #Explicit SSL/TLS Port
- "::1:587:587"
- "80.87.193.58:110:110" #POP3 Port
- "::1:110:110"
- "80.87.193.58:995:995" #POP3 Port
- "::1:995:995"
- "80.87.193.58:143:143" #IMAP Port
- "::1:143:143"
- "80.87.193.58:993:993" #IMAP Port
- "::1:993:993"
volumes:
- "/mailu/certs:/certs"
- "/mailu/overrides/nginx:/overrides:ro"
admin:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "/mailu/data:/data"
- "/mailu/dkim:/dkim"
depends_on:
- redis
imap:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}dovecot:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "/mailu/mail:/mail"
- "/mailu/overrides/dovecot:/overrides:ro"
depends_on:
- front
smtp:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}postfix:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "/mailu/mailqueue:/queue"
- "/mailu/overrides/postfix:/overrides:ro"
depends_on:
- front
antispam:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}rspamd:${MAILU_VERSION:-1.8}
hostname: antispam
restart: always
env_file: mailu.env
volumes:
- "/mailu/filter:/var/lib/rspamd"
- "/mailu/dkim:/dkim:ro"
- "/mailu/overrides/rspamd:/etc/rspamd/override.d:ro"
depends_on:
- front
# Optional services
antivirus:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}clamav:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "/mailu/filter:/data"
webdav:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}radicale:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "/mailu/dav:/data"
fetchmail:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}fetchmail:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
# Webmail
webmail:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}roundcube:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "/mailu/webmail:/data"
depends_on:
- imap
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.203.0/24
# Mailu main configuration file
#
# This file is autogenerated by the configuration management wizard for compose flavor.
# For a detailed list of configuration variables, see the documentation at
# https://mailu.io
###################################
# Common configuration variables
###################################
# Set to a randomly generated 16 bytes string
SECRET_KEY=PGA4SJSV0ZZDT5QE
# Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)
SUBNET=192.168.203.0/24
# Main mail domain
DOMAIN=artceptor.com
# Hostnames for this server, separated with comas
HOSTNAMES=mail.artceptor.com
# Postmaster local part (will append the main mail domain)
POSTMASTER=admin
# Choose how secure connections will behave (value: letsencrypt, cert, notls, mail, mail-letsencrypt)
TLS_FLAVOR=letsencrypt
# Authentication rate limit (per source IP address)
AUTH_RATELIMIT=10000/minute
# Opt-out of statistics, replace with "True" to opt out
DISABLE_STATISTICS=False
###################################
# Optional features
###################################
# Expose the admin interface (value: true, false)
ADMIN=true
# Choose which webmail to run if any (values: roundcube, rainloop, none)
WEBMAIL=roundcube
# Dav server implementation (value: radicale, none)
WEBDAV=radicale
# Antivirus solution (value: clamav, none)
ANTIVIRUS=clamav
###################################
# Mail settings
###################################
# Message size limit in bytes
# Default: accept messages up to 50MB
# Max attachment size will be 33% smaller
MESSAGE_SIZE_LIMIT=50000000
# Networks granted relay permissions
# Use this with care, all hosts in this networks will be able to send mail without authentication!
RELAYNETS=
# Will relay all outgoing mails if configured
RELAYHOST=
# Fetchmail delay
FETCHMAIL_DELAY=600
# Recipient delimiter, character used to delimiter localpart from custom address part
RECIPIENT_DELIMITER=+
# DMARC rua and ruf email
DMARC_RUA=admin
DMARC_RUF=admin
# Welcome email, enable and set a topic and body if you wish to send welcome
# emails to all users.
WELCOME=false
WELCOME_SUBJECT=Welcome to your new email account
WELCOME_BODY=Welcome to your new email account, if you can read this, then it is configured properly!
# Maildir Compression
# choose compression-method, default: none (value: bz2, gz)
COMPRESSION=
# change compression-level, default: 6 (value: 1-9)
COMPRESSION_LEVEL=
# IMAP full-text search is enabled by default. Set the following variable to off in order to disable the feature.
# FULL_TEXT_SEARCH=off
###################################
# Web settings
###################################
# Path to redirect / to
WEBROOT_REDIRECT=/webmail
# Path to the admin interface if enabled
WEB_ADMIN=/admin
# Path to the webmail if enabled
WEB_WEBMAIL=/webmail
# Website name
SITENAME=Mailu
# Linked Website URL
WEBSITE=https://artceptor.com
###################################
# Advanced settings
###################################
# Log driver for front service. Possible values:
# json-file (default)
# journald (On systemd platforms, useful for Fail2Ban integration)
# syslog (Non systemd platforms, Fail2Ban integration. Disables `docker-compose log` for front!)
# LOG_DRIVER=json-file
# Docker-compose project name, this will prepended to containers names.
COMPOSE_PROJECT_NAME=mailu
# Default password scheme used for newly created accounts and changed passwords
# (value: PBKDF2, BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT)
PASSWORD_SCHEME=PBKDF2
# Header to take the real ip from
REAL_IP_HEADER=
# IPs for nginx set_real_ip_from (CIDR list separated by commas)
REAL_IP_FROM=
# choose wether mailu bounces (no) or rejects (yes) mail when recipient is unknown (value: yes, no)
REJECT_UNLISTED_RECIPIENT=
# Log level threshold in start.py (value: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET)
LOG_LEVEL=WARNING
###################################
# Database settings
###################################
DB_FLAVOR=sqlite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment