From 7b89cd445a50ffeb81b370e82869aa5b44ce1d50 Mon Sep 17 00:00:00 2001 From: Rish Date: Wed, 6 Nov 2019 18:36:15 +0700 Subject: [PATCH] Fixed unsubscribe url for preview email --- core/server/services/bulk-email/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/server/services/bulk-email/index.js b/core/server/services/bulk-email/index.js index c9da487659..5813678791 100644 --- a/core/server/services/bulk-email/index.js +++ b/core/server/services/bulk-email/index.js @@ -27,7 +27,10 @@ module.exports = { const messageToSend = Object.assign({}, message, { to: recipient }); - const unsubscribeUrl = recipientData[recipient].unsubscribe_url; + let unsubscribeUrl = ''; + if (recipientData && recipientData[recipient]) { + unsubscribeUrl = recipientData[recipient].unsubscribe_url; + } messageToSend.html = messageToSend.html.replace('%recipient.unsubscribe_url%', unsubscribeUrl); try { await ghostMailer.send(messageToSend);