Allow Gmail node to send messages formatted as HTML (#1285)

* Allowing Gmail node to send messages formatted as HTML

* Improving message field description

* Fixing lint issues

* Adding missing trailing comma

*  Small improvements to GMail-Node

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Omar Ajoue
2021-01-07 11:58:28 +01:00
committed by GitHub
parent 9b6f0ee3ee
commit 143c8bd326
4 changed files with 98 additions and 5 deletions

View File

@@ -133,20 +133,23 @@ export async function encodeEmail(email: IEmail) {
const mailOptions = {
to: email.to,
cc : email.cc,
cc: email.cc,
bcc: email.bcc,
replyTo: email.inReplyTo,
references: email.reference,
subject: email.subject,
text: email.body,
} as IDataObject;
if (email.htmlBody) {
mailOptions.html = email.htmlBody;
}
if (email.attachments !== undefined && Array.isArray(email.attachments) && email.attachments.length > 0) {
const attachments = email.attachments.map((attachment) => ({
filename: attachment.name,
content: attachment.content,
contentType: attachment.type,
encoding : 'base64',
encoding: 'base64',
}));
mailOptions.attachments = attachments;