From 5203d50c183051459905f00d4df64ca209ac2494 Mon Sep 17 00:00:00 2001 From: Filip Date: Tue, 26 May 2020 13:59:03 +0200 Subject: [PATCH] Change value key in content array from content to value --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index e7c8d33..5c64e56 100644 --- a/index.js +++ b/index.js @@ -68,7 +68,7 @@ class SendGridTransport { { let alternatives = source.alternatives.map(entry => { let alternative = { - content: entry.content, + value: entry.content, type: entry.contentType }; return alternative; @@ -91,7 +91,7 @@ class SendGridTransport { case 'watchHtml': { let alternative = { - content: source.watchHtml, + value: source.watchHtml, type: 'text/watch-html' }; msg.content = [].concat(msg.content || []).concat(alternative); @@ -113,14 +113,14 @@ class SendGridTransport { }); if (msg.content && msg.content.length) { - if (msg.text) { - msg.content.unshift({ type: 'text/plain', content: msg.text }); - delete msg.text; - } if (msg.html) { - msg.content.unshift({ type: 'text/html', content: msg.html }); + msg.content.unshift({ type: 'text/html', value: msg.html }); delete msg.html; } + if (msg.text) { + msg.content.unshift({ type: 'text/plain', value: msg.text }); + delete msg.text; + } } sgMail.send(msg, callback);