diff --git a/.dockerignore b/.dockerignore index 7dc0d74..c316059 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ data/* .git .github docs +logs/* diff --git a/README.md b/README.md index 428ca0f..2d67d50 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,19 @@ Just edit the `config.ini` You can use the following settings - `ADMIN` -> An email address (doesn't have to exist, just has to be valid) that will list all emails of all addresses the server has received. Kind of a catch-all - `DATEFORMAT` -> How should timestamps be shown on the web interface ([moment.js syntax](https://momentjs.com/docs/#/displaying/)) +## Docker env vars +In Docker you can use the following environment variables: + +| ENV var | What it does | Example values | +| --------|--------------|----------| +| URL | The URL of the web interface. Used by the API and RSS feed | http://localhost:8080 | +| DISCARD_UNKNOWN | Tells the Mailserver to wether or not delete emails that are addressed to domains that are not configured | true, false | +| DOMAINS | The whitelisted Domains the server will listen for. If DISCARD_UNKNOWN is set to false, this will only be used to generate random emails in the webinterface | +| SHOW_ACCOUNT_LIST | If set to `true`, all accounts that have previously received emails can be listed via API or webinterface | true,false | +| ADMIN | If set to a valid email address and this address is entered in the API or webinterface, will show all emails of all accounts. Kind-of catch-all | test@test.com +| DATEFORMAT | Will format the received date in the web interface based on [moment.js](https://momentjs.com/) syntax | "MMMM Do YYYY, h:mm:ss a" | + + # Roadmap - [x] Mail server - [x] Storing received mails in JSON @@ -135,17 +148,4 @@ docker run -d --restart=unless-stopped --name opentrashmail -e "DOMAINS=mydomain # How it works -The heart of Open Trashmail is a **Python-powered SMTP server** that listens on incoming emails and stores them as JSON files. 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 address of your machine. - -# Configuration - -In Docker you can use the following environment variables: - -| ENV var | What it does | Example values | -| --------|--------------|----------| -| DISCARD_UNKNOWN | Tells the Mailserver to wether or not delete emails that are addressed to domains that are not configured | true, false | -| DOMAINS | The whitelisted Domains the server will listen for. If DISCARD_UNKNOWN is set to false, this will only be used to generate random emails in the webinterface | -| URL | The URL of the web interface. Used by the API and RSS feed | http://localhost:8080 | -| SHOW_ACCOUNT_LIST | If set to `true`, all accounts that have previously received emails can be listed via API or webinterface | true,false | -| ADMIN | If set to a valid email address and this address is entered in the API or webinterface, will show all emails of all accounts. Kind-of catch-all | test@test.com -| DATEFORMAT | Will format the received date in the web interface based on [moment.js](https://momentjs.com/) syntax | "MMMM Do YYYY, h:mm:ss a" | +The heart of Open Trashmail is a **Python-powered SMTP server** that listens on incoming emails and stores them as JSON files. 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 address of your machine. \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 8e4d5f6..c2fa098 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,8 +21,8 @@ RUN sed -i 's/nobody/nginx/g' /etc/php7/php-fpm.d/www.conf WORKDIR /var/www/opentrashmail # Volumes to mount -#VOLUME /var/lib/influxdb VOLUME /var/www/opentrashmail/data +VOLUME /var/www/opentrashmail/logs EXPOSE 80 25 diff --git a/docker/rootfs/nginx.conf b/docker/rootfs/nginx.conf index 314adb3..d2f1fd5 100644 --- a/docker/rootfs/nginx.conf +++ b/docker/rootfs/nginx.conf @@ -14,8 +14,8 @@ server { # logging - access_log /var/log/nginx/opentrashmail/web.access.log; - error_log /var/log/nginx/opentrashmail/web.error.log warn; + access_log /var/www/opentrashmail/logs/web.access.log; + error_log /var/www/opentrashmail/logs/web.error.log warn; location ~ \.php$ { # 404 diff --git a/docker/rootfs/start.sh b/docker/rootfs/start.sh index cf96cc3..4bc636d 100644 --- a/docker/rootfs/start.sh +++ b/docker/rootfs/start.sh @@ -72,4 +72,4 @@ fi chown -R nginx:nginx /var/www/opentrashmail/data echo ' [+] Starting Mailserver' -su - nginx -s /bin/ash -c 'cd /var/www/opentrashmail/python;python mailserver.py' +su - nginx -s /bin/ash -c 'cd /var/www/opentrashmail/python;python mailserver.py > /var/www/opentrashmail/logs/mailserver.log 2>&1 ' diff --git a/logs/.gitignore b/logs/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/python/mailserver.py b/python/mailserver.py index 6e3d52d..3b0c8a7 100755 --- a/python/mailserver.py +++ b/python/mailserver.py @@ -98,7 +98,6 @@ def process_message(self, peer, mailfrom, rcpttos, data): except: logger.exception('Error reading incoming email') else: - # this data will be sent as POST data edata = { 'subject': subject, 'body': body, diff --git a/tools/pop3_server.php b/tools/experimental_pop3_server.php similarity index 100% rename from tools/pop3_server.php rename to tools/experimental_pop3_server.php diff --git a/web/css/default.min.css:Zone.Identifier b/web/css/default.min.css:Zone.Identifier deleted file mode 100644 index 224de23..0000000 --- a/web/css/default.min.css:Zone.Identifier +++ /dev/null @@ -1,3 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -ReferrerUrl=C:\Users\chris\Downloads\pico-1.5.10.zip