Skip to content

Commit

Permalink
make sure that email has a body
Browse files Browse the repository at this point in the history
  • Loading branch information
okanji committed Jan 3, 2019
1 parent 5b65166 commit 3469788
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ app.post('/', function(req, res) {
// Construct Message
var emailMessage = req.body.message;

// Make sure the email message is not empty
if (!emailMessage) {
res.send({
error: 'Error, email message is empty'
});
return;
}

// Create string of _fields elements to add at end of message
if (emailMessage) {
emailMessage += '\r\n\r\n';
Expand Down

0 comments on commit 3469788

Please sign in to comment.