From f372459eccc7e766530f82c95c232ed739f829ac Mon Sep 17 00:00:00 2001 From: Ricardo Espinoza Date: Fri, 30 Jul 2021 10:26:57 -0400 Subject: [PATCH] :zap: Add sender name parameter to Gmail Node (#2038) * :zap: Add sender name parameter * :zap: Small description improvement Co-authored-by: Jan Oberhauser --- .../nodes-base/nodes/Google/Gmail/GenericFunctions.ts | 1 + packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts | 3 +++ .../nodes/Google/Gmail/MessageDescription.ts | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts b/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts index 778f6ea2f6..d76dd48d28 100644 --- a/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts @@ -142,6 +142,7 @@ export async function encodeEmail(email: IEmail) { let mailBody: Buffer; const mailOptions = { + from: email.from, to: email.to, cc: email.cc, bcc: email.bcc, diff --git a/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts b/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts index 1107630f05..5b72a2c80e 100644 --- a/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts +++ b/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts @@ -45,6 +45,7 @@ import { } from 'lodash'; export interface IEmail { + from?: string; to?: string; cc?: string; bcc?: string; @@ -355,6 +356,7 @@ export class Gmail implements INodeType { } const email: IEmail = { + from: additionalFields.senderName as string || '', to: toStr, cc: ccStr, bcc: bccStr, @@ -455,6 +457,7 @@ export class Gmail implements INodeType { } const email: IEmail = { + from: additionalFields.senderName as string || '', to: toStr, cc: ccStr, bcc: bccStr, diff --git a/packages/nodes-base/nodes/Google/Gmail/MessageDescription.ts b/packages/nodes-base/nodes/Google/Gmail/MessageDescription.ts index a860580951..a257985509 100644 --- a/packages/nodes-base/nodes/Google/Gmail/MessageDescription.ts +++ b/packages/nodes-base/nodes/Google/Gmail/MessageDescription.ts @@ -277,6 +277,16 @@ export const messageFields = [ placeholder: 'info@example.com', default: [], }, + { + displayName: 'Sender Name', + name: 'senderName', + type: 'string', + placeholder: 'Name ', + default: '', + description: `The name displayed in your contacts inboxes.
+ It has to be in the format: "Display-Name <name@gmail.com>".
+ The email address has to match the email address of the logged in user for the API`, + }, ], }, {