diff --git a/README.md b/README.md index f96c49d..4b3650c 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,24 @@ # Quick start +Simple start with no persistence -``` +```bash docker run --it -p 25:25 -p 80:80 hascheksolutions/opentrashmail ``` +Saving data directory on host machine + +```bash +docker run -p 80:80 -p 25:25 -v /path/on/host/where/to/save/data:/var/www/opentrashmail/data hascheksolutions/opentrashmail +``` + +Complete example with running as daemon, persistence and auto restart + +```bash +docker run -d --restart=always --name opentrashmail -p 80:80 -p 25:25 -v /path/on/host/where/to/save/data:/var/www/opentrashmail/data hascheksolutions/opentrashmail +``` + # How it works The heart of Open Trashmail is a **python powered SMTP server** that listens on incoming emails and stores them as json objects. The server doesn't have to know the right Email domain, it will just **catch everything** it receives. You only have to **expose port 25 to the web** and set an **MX record** of your domain pointing to the IP adress of your machine. diff --git a/docker/rootfs/start.sh b/docker/rootfs/start.sh index 621c8ec..edc154d 100644 --- a/docker/rootfs/start.sh +++ b/docker/rootfs/start.sh @@ -6,8 +6,6 @@ cd /var/www/opentrashmail git pull - - echo ' [+] Starting php' php-fpm7 @@ -22,8 +20,18 @@ touch /var/log/nginx/opentrashmail/web.error.log nginx -cd /var/www/opentrashmail/python +echo ' [+] Setting up config.ini' +echo "[GENERAL]" > /var/www/opentrashmail/config.ini +if [ "$DOMAINS" != "" ]; then + echo "DOMAINS=$DOMAINS" >> /var/www/opentrashmail/config.ini + echo " [i] Active Domain(s): $DOMAINS" +fi + +echo "[MAILSERVER]" >> /var/www/opentrashmail/config.ini +echo "PORT=25" >> /var/www/opentrashmail/config.ini + +cd /var/www/opentrashmail/python echo ' [+] Starting Mailserver' python mailserver.py diff --git a/web/js/opentrashmail.js b/web/js/opentrashmail.js index f1a84a3..e726001 100644 --- a/web/js/opentrashmail.js +++ b/web/js/opentrashmail.js @@ -124,9 +124,13 @@ function accessAccount() function generateAccount() { - var email = makeName()+'@'+domains[Math.floor(Math.random()*domains.length)]; - - loadAccount(email) + if(domains===null) + alert("No domains configured in settings.ini") + else + { + var email = makeName()+'@'+domains[Math.floor(Math.random()*domains.length)]; + loadAccount(email) + } } function changeHash(val)