Update missing email 404 page
parent
7f8630422c
commit
fb8ee6dca3
|
@ -279,9 +279,8 @@ class ImapService extends EventEmitter {
|
||||||
|
|
||||||
const messages = await this.connection.search(searchCriteria, fetchOptions)
|
const messages = await this.connection.search(searchCriteria, fetchOptions)
|
||||||
if (messages.length === 0) {
|
if (messages.length === 0) {
|
||||||
throw new Error('email not found')
|
return("womp womp")
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullBody = _.find(messages[0].parts, {which: ''})
|
const fullBody = _.find(messages[0].parts, {which: ''})
|
||||||
return simpleParser(fullBody.body)
|
return simpleParser(fullBody.body)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ router.get(
|
||||||
req.params.address,
|
req.params.address,
|
||||||
req.params.uid
|
req.params.uid
|
||||||
)
|
)
|
||||||
if (mail) {
|
if (mail && !mail == "womp womp") {
|
||||||
// Emails are immutable, cache if found
|
// Emails are immutable, cache if found
|
||||||
res.set('Cache-Control', 'private, max-age=600')
|
res.set('Cache-Control', 'private, max-age=600')
|
||||||
res.render('mail', {
|
res.render('mail', {
|
||||||
|
@ -44,7 +44,7 @@ router.get(
|
||||||
madebysite: config.branding[2]
|
madebysite: config.branding[2]
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
next({message: 'email not found', status: 404})
|
next({message: 'This mail could not be found. It either does not exist or has been deleted from our servers!', status: 404})
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('error while fetching one email', error)
|
console.error('error while fetching one email', error)
|
||||||
|
|
Loading…
Reference in New Issue