Updated with instructions.

This commit is contained in:
Juan Luis Baptiste 2015-04-19 17:28:21 -05:00
parent d7b2ba04ca
commit dc6d77d6aa
1 changed files with 38 additions and 1 deletions

View File

@ -1,2 +1,39 @@
# docker-postfix
Simple SMTP relay docker image.
Simple Postfix SMTP TLS relay docker image.Run it like this:
### Build instructions
Clone this repo and then:
cd docker-Postfix
sudo docker build -t postfix .
You can also find a prebuilt docker image from [Docker Hub](https://registry.hub.docker.com/u/juanluisbaptiste/postfix/), which can be pulled from the Hub:
sudo docker pull juanluisbaptiste/postfix:latest
### How to run it
The following env variables need to be passed to the container:
* `SMTP_SERVER` Server address of the SMTP server to use.
* `SMTP_USERNAME` Username to authenticate with.
* `SMTP_PASSWORD` Password of the SMTP user.
To use this container from anywhere, the port 25 needs to be exposed to the docker host server:
docker run --rm --name postfix -p "25:25" -e SMTP_SERVER=smtp.bar.com -e SMTP_USERNAME=foo@bar.com -e SMTP_PASSWORD=XXXXXXXX postfix
If you are going to use this container from other docker containers then it's better to just publish the port:
docker run --rm --name postfix -P -e SMTP_SERVER=smtp.bar.com -e SMTP_USERNAME=foo@bar.com -e SMTP_PASSWORD=XXXXXXXX postfix
## A note about using gmail as a relay
Since last year, Gmail by default (does not allow email clients that don't use OAUTH 2)[http://googleonlinesecurity.blogspot.co.uk/2014/04/new-security-measures-will-affect-older.html]
for authentication (like Thunderbird or Outlook). First you need to enable access to "Less secure apps" on your
[google settings](https://www.google.com/settings/security/lesssecureapps).
Also take into account that email `From:` header will contain the email address of the account being used to
authenticate against the Gmail SMTP server(SMTP_USERNAME), the one on the email will be ignored by Gmail.