##Testing mail server in a box.
The idea of this system is to help test the development of transactional emails and not be concerned about any email scripts you might use while developing. When testing emails sending out to actual email accounts is a bad idea. You want your code to be solid before thousands of emails are sent, this system will provide a solution so emails are not sent to actual mailboxes. If you are looking for a functional IMAP server visit this branch
- Only emails or domains you grant access to will relay, this will allow you to point a domain to the final destination mail server.
- The mail-loopback-base will contain all the default configuration files and any updates should be added to this container.
- Authentication creditials are stored in
Two build processes exist, use either fig or make to create an IMAP server with any important data safely keep in a persistent container. Make sure you switch to the git branch
CoreOS does not include
make so you will need to open the
Makefile and peice a few things together. This is one area I would love to see improved. Maybe build some
fleetctl service files?
$ git clone email@example.com:htmlgraphic/Mail-Server.git && cd Mail-Server $ git checkout loopback $ make data $ make build $ make run $ make start
$ git clone firstname.lastname@example.org:htmlgraphic/dockermail.git && cd dockermail $ git checkout loopback $ fig up -d
dovecot: SMTP and IMAP server. This container uses postfix / sasl as MTA and dovecot as IMAP server. All incoming mail to your own domains is accepted. For outgoing mail, only authenticated (logged in with username and password) clients can send messages via STARTTLS on port 587. Most programming langauges have a email library which can be used to connect securely for delivery. Within your application you can specifiy this docker instance hosted online. IE: test-smtp.domain.tld 587 using (TLS)
mail-loopback-base: This image is used to create the needed scripts which will live on the data container. This will allow you to share configuration files between multiple docker images.
###1) Allow email addresses
Any domains you want to receive mail should be listed
htmlgraphic.com smtp:[imap-test.htmlgraphic.com]:587 otherdomain.com smtp:[imap-test.htmlgraphic.com]:587
Any domains listed with the transport file will be sent out of the system and to the smtp host you specify. ALL other emails sent to this instance will bounce around and be removed from the queue every 12 hours. If you edit the
transport file you will need to run
postmap /etc/postfix/transport and
###2) Add user aliases
Edit the file
mailbase/aliases, to add any needed aliases:
root email@example.com firstname.lastname@example.org email@example.com firstname.lastname@example.org email@example.com firstname.lastname@example.org email@example.com @example.net firstname.lastname@example.org
An IMAP mail account is created for each entry on the right hand side.
Every mail sent to one of the addresses in the left column will
be delivered to the corresponding account in the right column.
###3) Add, review incoming username / password
Edit the file
mailbase/passwords with the following:
To get the password hash values, you can connect to a running instance, if you are using Docker 1.3 and above.
###4) Add, review outgoing username / passwords
Edit the file
mailbase/sasl_passwd with the following:
If you edit the
sasl_passwd file you will need to run
postmap /etc/postfix/sasl_passwd and
Login to a running container, needs Docker 1.3 or greater. Optional, run the following after connecting to the running container:
$ docker exec -it <container.id> /bin/bash $ doveadm pw -s <scheme-name>
Need to update the system configuration files, make changes to any the files found with
/mailbase directory. Then, rebuild the dovecot container for the updates to take effect.
$ make stop $ make remove $ make build
Everything should be up and working, you should now be authenicating to send email but only the domain you set will delivery the email to logit mailboes . To check the running system run the following
$ docker logs <container.id>