diff --git a/core/server/api/canary/email-preview.js b/core/server/api/canary/email-preview.js index 36566e2d72..13ac07b2be 100644 --- a/core/server/api/canary/email-preview.js +++ b/core/server/api/canary/email-preview.js @@ -58,9 +58,8 @@ module.exports = { message: common.i18n.t('errors.api.posts.postNotFound') }); } - const post = model.toJSON(); const {emails = []} = frame.data; - const response = await mega.mega.sendTestEmail(post, emails); + const response = await mega.mega.sendTestEmail(model, emails); if (response && response[0] && response[0].error) { throw new common.errors.EmailError({ message: response[0].error.message diff --git a/core/server/services/mega/mega.js b/core/server/services/mega/mega.js index 820378b79a..7daf0d5aee 100644 --- a/core/server/services/mega/mega.js +++ b/core/server/services/mega/mega.js @@ -34,7 +34,8 @@ const sendEmail = async (post, members) => { return bulkEmailService.send(emailTmpl, emails, emailData); }; -const sendTestEmail = async (post, emails) => { +const sendTestEmail = async (postModel, emails) => { + const post = await serialize(postModel); const {emailTmpl} = getEmailData(post); const emailData = emails.reduce((emailData, email) => { return Object.assign({