cleanup and enhanced logs

This commit is contained in:
Chris 2023-11-18 09:14:31 +01:00
parent 820f75e21a
commit 90f7bcb1fd
9 changed files with 21 additions and 22 deletions

View File

@ -3,3 +3,4 @@ data/*
.git
.github
docs
logs/*

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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 '

2
logs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -98,7 +98,6 @@ class CustomSMTPServer(smtpd.SMTPServer):
except:
logger.exception('Error reading incoming email')
else:
# this data will be sent as POST data
edata = {
'subject': subject,
'body': body,

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\chris\Downloads\pico-1.5.10.zip