summaryrefslogtreecommitdiff
path: root/modules/email
diff options
context:
space:
mode:
Diffstat (limited to 'modules/email')
-rw-r--r--modules/email/email.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/email/email.js b/modules/email/email.js
index e4d342b..d7fe171 100644
--- a/modules/email/email.js
+++ b/modules/email/email.js
@@ -41,10 +41,16 @@ function sendEmail(recip, text) {
}
module.exports = function(app, io, moddir) {
- var allowedRecipients =
- fs.readFileSync(moddir + "/allowed_recipients.txt").toString().trim().split("\n");
+ var allowedRecipients, password;
- var password = fs.readFileSync(moddir + "/password.txt").toString().trim();
+ try {
+ allowedRecipients =
+ fs.readFileSync(moddir + "/allowed_recipients.txt").toString().trim().split("\n");
+ password = fs.readFileSync(moddir + "/password.txt").toString().trim();
+ } catch (e) {
+ console.error(e);
+ return false;
+ }
app.post("/email", bodyParser.json(), function(req, res) {
var body = req.body;