Easy to use error handler - mail uncaughtException, SIGINT and process exits
npm install simpleerrorhandler
node tests/examples.js
- Create or modify your config.json in your root folder from the 'config.json.example'
- Require simpleerrorhandler in your pogram and execute the init
const simpleErrorHandler = require('simpleerrorhandler');
//Set error handling
simpleErrorHandler.init('/location/to/your/config.json');
Be sure you have an config.json file in your root directory with the content as discribed in config.json.example
{
"SIMPLEMAILER": {
"SERVER": {
"HOST":"mail.domain.com",
"PORT":"587",
"USERNAME":"username",
"PASSWORD":"password",
"SECURE": "false",
"DKIM": {
"DOMAINNAME": "mail.domain.com",
"KEYSELECTOR": "2017",
"PRIVATEKEY": "./DKIM/private.key",
"CACHEDIR": "/tmp",
"CACHETRESHOLD": 86400
},
"TLS": {
"REJECTUNAUTHORIZED": false
}
},
"FROMNAME": "from name",
"FROMEMAIL": "email@domain.com",
"REPLYTO": "reply@domain.com"
},
"SIMPLEERRORHANDLING": {
"MAIL": {
"FROM": "Simple errorHandler",
"EMAIL": "mail@test.nl"
},
"MOBILE": [
]
}
}