mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
🐛 Keep BCC headers when sending email - Gmail node (#2721)
* 🐛 Keep BCC headers when sending email * ⚡ Fix typo Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
ebd4aa4c31
commit
9639742cc6
|
@ -156,6 +156,7 @@ export async function encodeEmail(email: IEmail) {
|
||||||
references: email.reference,
|
references: email.reference,
|
||||||
subject: email.subject,
|
subject: email.subject,
|
||||||
text: email.body,
|
text: email.body,
|
||||||
|
keepBcc: true,
|
||||||
} as IDataObject;
|
} as IDataObject;
|
||||||
if (email.htmlBody) {
|
if (email.htmlBody) {
|
||||||
mailOptions.html = email.htmlBody;
|
mailOptions.html = email.htmlBody;
|
||||||
|
@ -172,14 +173,15 @@ export async function encodeEmail(email: IEmail) {
|
||||||
mailOptions.attachments = attachments;
|
mailOptions.attachments = attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mail = new mailComposer(mailOptions).compile();
|
||||||
|
|
||||||
const mail = new mailComposer(mailOptions);
|
// by default the bcc headers are deleted when the mail is built.
|
||||||
|
// So add keepBcc flag to averride such behaviour. Only works when
|
||||||
|
// the flag is set after the compilation.
|
||||||
|
//https://nodemailer.com/extras/mailcomposer/#bcc
|
||||||
|
mail.keepBcc = true;
|
||||||
|
|
||||||
mailBody = await new Promise((resolve) => {
|
mailBody = await mail.build();
|
||||||
mail.compile().build(async (err: string, result: Buffer) => {
|
|
||||||
resolve(result);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return mailBody.toString('base64').replace(/\+/g, '-').replace(/\//g, '_');
|
return mailBody.toString('base64').replace(/\+/g, '-').replace(/\//g, '_');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue