n8n-nodes-gmail-custom 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -223,7 +223,7 @@ class GmailCustom {
|
|
|
223
223
|
group: ['output'],
|
|
224
224
|
version: 1,
|
|
225
225
|
subtitle: '={{$parameter["subject"] || "Send Email"}}',
|
|
226
|
-
description: 'Send email via Gmail API with token caching
|
|
226
|
+
description: 'Send email via Gmail API with token caching for service accounts',
|
|
227
227
|
defaults: {
|
|
228
228
|
name: 'Gmail Custom',
|
|
229
229
|
color: '#1a73e8',
|
|
@@ -343,13 +343,6 @@ class GmailCustom {
|
|
|
343
343
|
default: '',
|
|
344
344
|
description: 'The email address that the reply message is sent to',
|
|
345
345
|
},
|
|
346
|
-
{
|
|
347
|
-
displayName: 'Append n8n Attribution',
|
|
348
|
-
name: 'appendAttribution',
|
|
349
|
-
type: 'boolean',
|
|
350
|
-
default: true,
|
|
351
|
-
description: 'Whether to include the phrase "This email was sent automatically with n8n" to the end of the email',
|
|
352
|
-
},
|
|
353
346
|
],
|
|
354
347
|
},
|
|
355
348
|
],
|
|
@@ -382,7 +375,6 @@ class GmailCustom {
|
|
|
382
375
|
let cc = options.ccList || '';
|
|
383
376
|
let bcc = options.bccList || '';
|
|
384
377
|
let replyTo = options.replyTo || '';
|
|
385
|
-
const appendAttribution = options.appendAttribution === undefined ? true : options.appendAttribution;
|
|
386
378
|
|
|
387
379
|
let bodyText = message;
|
|
388
380
|
let bodyHtml = '';
|
|
@@ -395,14 +387,6 @@ class GmailCustom {
|
|
|
395
387
|
bodyText = message;
|
|
396
388
|
}
|
|
397
389
|
|
|
398
|
-
if (appendAttribution) {
|
|
399
|
-
if (emailType === 'html') {
|
|
400
|
-
bodyHtml += '<br><br>---<br><em>This email was sent automatically with n8n</em>';
|
|
401
|
-
} else {
|
|
402
|
-
bodyText += '\n\n---\nThis email was sent automatically with n8n';
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
390
|
const credentials = await this.getCredentials('googleApi');
|
|
407
391
|
const accessToken = await getOrRefreshAccessToken(this, credentials, fromEmail);
|
|
408
392
|
|
|
@@ -441,40 +425,20 @@ class GmailCustom {
|
|
|
441
425
|
attachments,
|
|
442
426
|
});
|
|
443
427
|
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
Authorization: `Bearer ${accessToken}`,
|
|
454
|
-
'Content-Type': 'application/json',
|
|
455
|
-
},
|
|
456
|
-
body: { raw: base64UrlMessage },
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
returnData.push({
|
|
460
|
-
json: sendResponse,
|
|
461
|
-
pairedItem: { item: i },
|
|
462
|
-
});
|
|
463
|
-
lastError = null;
|
|
464
|
-
break;
|
|
465
|
-
} catch (error) {
|
|
466
|
-
lastError = error;
|
|
467
|
-
const statusCode = error.statusCode || error.response?.statusCode;
|
|
468
|
-
if (statusCode === 429 && attempt < maxRetries) {
|
|
469
|
-
const delay = Math.min(Math.pow(2, attempt) * 1000 + Math.random() * 1000, 30000);
|
|
470
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
471
|
-
continue;
|
|
472
|
-
}
|
|
473
|
-
throw error;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
428
|
+
const sendResponse = await this.helpers.httpRequest({
|
|
429
|
+
method: 'POST',
|
|
430
|
+
url: 'https://gmail.googleapis.com/gmail/v1/users/me/messages/send',
|
|
431
|
+
headers: {
|
|
432
|
+
Authorization: `Bearer ${accessToken}`,
|
|
433
|
+
'Content-Type': 'application/json',
|
|
434
|
+
},
|
|
435
|
+
body: { raw: base64UrlMessage },
|
|
436
|
+
});
|
|
476
437
|
|
|
477
|
-
|
|
438
|
+
returnData.push({
|
|
439
|
+
json: sendResponse,
|
|
440
|
+
pairedItem: { item: i },
|
|
441
|
+
});
|
|
478
442
|
|
|
479
443
|
} catch (error) {
|
|
480
444
|
let continueOnFail = false;
|