Fixed unsubscribe url for preview email

This commit is contained in:
Rish 2019-11-06 18:36:15 +07:00
parent 4b24780ebd
commit 7b89cd445a

View File

@ -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);