UBUNTU POSTFIX and DOVECOT server for getting and sending e-mails
10K+
This image provides an UBUNTU container with a preinstalled POSTFIX and DOVECOT server for getting and sending e-mails.
It has a built in option to use your GMail account as an SMTP relay.
The incoming mails can be downloaded by a POP3/SMTP client.
Assuming that your user has the docker privileges, here is an example for creating and running the container:
docker run -d -t \
-p 25:25 \
-p 110:110 \
-p 143:143 \
-e EMAIL_DOMAIN="MyMailDomain.com, MyOtherMailDomain.net" \
--name MyPostfixContainer mbinunn/ubuntu_mail_pop3_imap_server_postfix_dovecot_gmailsmtp
If you want to use the GMail SMTP feature, use:
docker run -d -t \
-p 25:25 \
-p 110:110 \
-p 143:143 \
-e EMAIL_DOMAIN="MyMailDomain.com, MyOtherMailDomain.net" \
-e USE_GMAIL_SMTP=1 \
-e GMAIL_SMTP_USER=[email protected] \
-e GMAIL_SMTP_PASSWD=MyGmailPassword \
--name MyPostfixContainer mbinunn/ubuntu_mail_pop3_imap_server_postfix_dovecot_gmailsmtp
If you want to load your own /var/mail into the container, use:
docker run -d -t \
-p 25:25 \
-p 110:110 \
-p 143:143 \
-v /path/to/local/var/mail/folder:/var/mail \
-e EMAIL_DOMAIN="MyMailDomain.com, MyOtherMailDomain.net" \
--name MyPostfixContainer mbinunn/ubuntu_mail_pop3_imap_server_postfix_dovecot_gmailsmtp
The server should be now up and starting getting emails and POP/IMAP requests.
To create e-mail accounts in the server, use:
docker exec -i -t -u root MyPostfixContainer bash -c "/root/mail-create-user.sh username password"
EMAIL_DOMAIN = Comma seperated list of accepted domains
USE_GMAIL_SMTP = Send it only if you want GMail SMTP, otherwise do not send
GMAIL_SMTP_USER = Full GMail user name including @gmail.com
GMAIL_SMTP_PASSWD = Gmail account's password
ROOT_PASSWD = Initializes the root password of UBUNTU
After making changes, installing software or changing startup.sh, save your own image by using the following command:
docker commit MyPostfixContainer my_own_postfix_image:v1
See my source code on https://github.com/mbinnun/Dockers/tree/main/ubuntu-mail-pop3-imap-server-postfix-dovecot-gmailsmtp
Content type
Image
Digest
Size
93.8 MB
Last updated
over 5 years ago
docker pull mbinunn/ubuntu_mail_pop3_imap_server_postfix_dovecot_gmailsmtp