diff --git a/application/imap-service.js b/application/imap-service.js index 190ae2c..1123ec8 100644 --- a/application/imap-service.js +++ b/application/imap-service.js @@ -254,6 +254,8 @@ class ImapService extends EventEmitter { .map(addressObj => addressObj.address) const from = headerPart.from.flatMap(from => addressparser(from)) + + // Specify default subject, in case none exists. let subject = "No Subject" try { subject = headerPart.subject[0] diff --git a/infrastructure/web/routes/inbox.js b/infrastructure/web/routes/inbox.js index 04cf3f3..f99f535 100644 --- a/infrastructure/web/routes/inbox.js +++ b/infrastructure/web/routes/inbox.js @@ -33,6 +33,12 @@ router.get( req.params.uid ) if (mail) { + + // Set a default subject if none is present + if (!mail.subject) { + mail.subject = 'No Subject' + } + // Emails are immutable, cache if found res.set('Cache-Control', 'private, max-age=600') res.render('mail', {