Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ pointing to the server you're running the docker container on.

* `URL` is the url to post the parsed email to. The url can contain basic auth credentials. Example: `https://user:password@requestb.in/1bcv6631`

* `__MAX_EMAIL_SIZE__` Allows you to modify the maximum size of an email. The default value is 1000000 for a 1MB email.

* The email is parsed to JSON and posted to the webhook. You can find an [example JSON body here](https://github.com/thingless/mailglove/blob/master/example_post_body.json).

Acknowledgments
===============
* thanks to https://github.com/catatnight/docker-postfix for initial docker container
* thanks to https://github.com/nodemailer/mailparser for a good email parser
* thanks to https://github.com/nodemailer/mailparser for a good email parser
3 changes: 3 additions & 0 deletions assets/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ postconf -e 'maillog_file = /dev/stdout'
# Make the webhook.js use the correct URI
sed -i "s/__URL__/${URL//\//\\/}/" /opt/webhook.js

# Make MAX_EMAIL_SIZE. 1MB emails by default
sed -i "s/__MAX_EMAIL_SIZE__/${MAX_EMAIL_SIZE:-1000000}/" /opt/webhook.js

#############
## Enable TLS
#############
Expand Down
2 changes: 1 addition & 1 deletion assets/webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var simpleParser = require('mailparser').simpleParser;
var request = require('request');

var WEBHOOK_URL = '__URL__'; //NOTE: can include basic auth in url!
var MAX_SIZE = parseInt(process.env.MAX_EMAIL_SIZE || 1000000); // Allow up to 1MB emails by default
var MAX_SIZE = parseInt(__MAX_EMAIL_SIZE__);

function makeRequest(options){
return new Promise((resolve, reject)=>{
Expand Down