@nocobase/plugin-workflow-mailer 2.2.20 → 2.2.21

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.
Files changed (173) hide show
  1. package/dist/externalVersion.js +6 -6
  2. package/dist/node_modules/joi/package.json +1 -1
  3. package/dist/node_modules/nodemailer/dist/cjs/addressparser/index.d.ts +59 -0
  4. package/dist/node_modules/nodemailer/dist/cjs/addressparser/index.js +790 -0
  5. package/dist/node_modules/nodemailer/dist/cjs/base64/index.d.ts +36 -0
  6. package/dist/node_modules/nodemailer/dist/cjs/base64/index.js +119 -0
  7. package/dist/node_modules/nodemailer/dist/cjs/dkim/index.d.ts +52 -0
  8. package/dist/node_modules/nodemailer/dist/cjs/dkim/index.js +228 -0
  9. package/dist/node_modules/nodemailer/dist/cjs/dkim/message-parser.d.ts +48 -0
  10. package/dist/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +180 -0
  11. package/dist/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.d.ts +36 -0
  12. package/dist/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.js +148 -0
  13. package/dist/node_modules/nodemailer/dist/cjs/dkim/sign.d.ts +52 -0
  14. package/dist/node_modules/nodemailer/dist/cjs/dkim/sign.js +165 -0
  15. package/dist/node_modules/nodemailer/dist/cjs/errors.d.ts +96 -0
  16. package/dist/node_modules/nodemailer/dist/cjs/errors.js +70 -0
  17. package/dist/node_modules/nodemailer/dist/cjs/fetch/cookies.d.ts +107 -0
  18. package/dist/node_modules/nodemailer/dist/cjs/fetch/cookies.js +282 -0
  19. package/dist/node_modules/nodemailer/dist/cjs/fetch/index.d.ts +65 -0
  20. package/dist/node_modules/nodemailer/dist/cjs/fetch/index.js +384 -0
  21. package/dist/node_modules/nodemailer/dist/cjs/json-transport/index.d.ts +64 -0
  22. package/dist/node_modules/nodemailer/dist/cjs/json-transport/index.js +99 -0
  23. package/dist/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +174 -0
  24. package/dist/node_modules/nodemailer/dist/cjs/mail-composer/index.js +613 -0
  25. package/dist/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +237 -0
  26. package/dist/node_modules/nodemailer/dist/cjs/mailer/index.js +415 -0
  27. package/dist/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +97 -0
  28. package/dist/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +342 -0
  29. package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +161 -0
  30. package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +787 -0
  31. package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/mime-types.d.ts +2 -0
  32. package/dist/node_modules/nodemailer/dist/cjs/mime-funcs/mime-types.js +2103 -0
  33. package/dist/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +333 -0
  34. package/dist/node_modules/nodemailer/dist/cjs/mime-node/index.js +1493 -0
  35. package/dist/node_modules/nodemailer/dist/cjs/mime-node/last-newline.d.ts +5 -0
  36. package/dist/node_modules/nodemailer/dist/cjs/mime-node/last-newline.js +32 -0
  37. package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-unix.d.ts +9 -0
  38. package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-unix.js +40 -0
  39. package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-windows.d.ts +10 -0
  40. package/dist/node_modules/nodemailer/dist/cjs/mime-node/le-windows.js +47 -0
  41. package/dist/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +124 -0
  42. package/dist/node_modules/nodemailer/dist/cjs/nodemailer.js +1 -0
  43. package/dist/node_modules/nodemailer/dist/cjs/package-info.d.ts +3 -0
  44. package/dist/node_modules/nodemailer/dist/cjs/package-info.js +7 -0
  45. package/dist/node_modules/nodemailer/dist/cjs/package.json +3 -0
  46. package/dist/node_modules/nodemailer/dist/cjs/punycode/index.d.ts +73 -0
  47. package/dist/node_modules/nodemailer/{lib → dist/cjs}/punycode/index.js +62 -111
  48. package/dist/node_modules/nodemailer/dist/cjs/qp/index.d.ts +32 -0
  49. package/dist/node_modules/nodemailer/dist/cjs/qp/index.js +207 -0
  50. package/dist/node_modules/nodemailer/dist/cjs/sendmail-transport/index.d.ts +69 -0
  51. package/dist/node_modules/nodemailer/dist/cjs/sendmail-transport/index.js +210 -0
  52. package/dist/node_modules/nodemailer/dist/cjs/ses-transport/index.d.ts +112 -0
  53. package/dist/node_modules/nodemailer/dist/cjs/ses-transport/index.js +252 -0
  54. package/dist/node_modules/nodemailer/dist/cjs/shared/index.d.ts +260 -0
  55. package/dist/node_modules/nodemailer/dist/cjs/shared/index.js +680 -0
  56. package/dist/node_modules/nodemailer/dist/cjs/shared/objects.d.ts +23 -0
  57. package/dist/node_modules/nodemailer/dist/cjs/shared/objects.js +43 -0
  58. package/dist/node_modules/nodemailer/dist/cjs/shared/url.d.ts +21 -0
  59. package/dist/node_modules/nodemailer/dist/cjs/shared/url.js +255 -0
  60. package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.d.ts +15 -0
  61. package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.js +108 -0
  62. package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +47 -0
  63. package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.js +189 -0
  64. package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +416 -0
  65. package/dist/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +1837 -0
  66. package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +133 -0
  67. package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +569 -0
  68. package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.d.ts +62 -0
  69. package/dist/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.js +257 -0
  70. package/dist/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +156 -0
  71. package/dist/node_modules/nodemailer/dist/cjs/smtp-transport/index.js +371 -0
  72. package/dist/node_modules/nodemailer/dist/cjs/stream-transport/index.d.ts +65 -0
  73. package/dist/node_modules/nodemailer/dist/cjs/stream-transport/index.js +146 -0
  74. package/dist/node_modules/nodemailer/dist/cjs/well-known/index.d.ts +35 -0
  75. package/dist/node_modules/nodemailer/dist/cjs/well-known/index.js +41 -0
  76. package/dist/node_modules/nodemailer/dist/cjs/well-known/services.d.ts +2 -0
  77. package/dist/node_modules/nodemailer/dist/cjs/well-known/services.js +674 -0
  78. package/dist/node_modules/nodemailer/dist/cjs/xoauth2/index.d.ts +201 -0
  79. package/dist/node_modules/nodemailer/dist/cjs/xoauth2/index.js +426 -0
  80. package/dist/node_modules/nodemailer/dist/esm/addressparser/index.d.ts +59 -0
  81. package/dist/node_modules/nodemailer/{lib → dist/esm}/addressparser/index.js +361 -131
  82. package/dist/node_modules/nodemailer/dist/esm/base64/index.d.ts +36 -0
  83. package/dist/node_modules/nodemailer/{lib → dist/esm}/base64/index.js +31 -56
  84. package/dist/node_modules/nodemailer/dist/esm/dkim/index.d.ts +52 -0
  85. package/dist/node_modules/nodemailer/{lib → dist/esm}/dkim/index.js +49 -78
  86. package/dist/node_modules/nodemailer/dist/esm/dkim/message-parser.d.ts +48 -0
  87. package/dist/node_modules/nodemailer/{lib → dist/esm}/dkim/message-parser.js +64 -42
  88. package/dist/node_modules/nodemailer/dist/esm/dkim/relaxed-body.d.ts +36 -0
  89. package/dist/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js +141 -0
  90. package/dist/node_modules/nodemailer/dist/esm/dkim/sign.d.ts +52 -0
  91. package/dist/node_modules/nodemailer/{lib → dist/esm}/dkim/sign.js +50 -46
  92. package/dist/node_modules/nodemailer/dist/esm/errors.d.ts +96 -0
  93. package/dist/node_modules/nodemailer/{lib → dist/esm}/errors.js +26 -18
  94. package/dist/node_modules/nodemailer/dist/esm/fetch/cookies.d.ts +107 -0
  95. package/dist/node_modules/nodemailer/dist/esm/fetch/cookies.js +242 -0
  96. package/dist/node_modules/nodemailer/dist/esm/fetch/index.d.ts +65 -0
  97. package/dist/node_modules/nodemailer/{lib → dist/esm}/fetch/index.js +80 -147
  98. package/dist/node_modules/nodemailer/dist/esm/json-transport/index.d.ts +64 -0
  99. package/dist/node_modules/nodemailer/{lib → dist/esm}/json-transport/index.js +19 -39
  100. package/dist/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +174 -0
  101. package/dist/node_modules/nodemailer/{lib → dist/esm}/mail-composer/index.js +199 -265
  102. package/dist/node_modules/nodemailer/dist/esm/mailer/index.d.ts +237 -0
  103. package/dist/node_modules/nodemailer/{lib → dist/esm}/mailer/index.js +128 -234
  104. package/dist/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +97 -0
  105. package/dist/node_modules/nodemailer/{lib → dist/esm}/mailer/mail-message.js +62 -114
  106. package/dist/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +161 -0
  107. package/dist/node_modules/nodemailer/dist/esm/mime-funcs/index.js +738 -0
  108. package/dist/node_modules/nodemailer/dist/esm/mime-funcs/mime-types.d.ts +2 -0
  109. package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-funcs/mime-types.js +29 -42
  110. package/dist/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +333 -0
  111. package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/index.js +259 -372
  112. package/dist/node_modules/nodemailer/dist/esm/mime-node/last-newline.d.ts +5 -0
  113. package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/last-newline.js +4 -10
  114. package/dist/node_modules/nodemailer/dist/esm/mime-node/le-unix.d.ts +9 -0
  115. package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/le-unix.js +6 -11
  116. package/dist/node_modules/nodemailer/dist/esm/mime-node/le-windows.d.ts +10 -0
  117. package/dist/node_modules/nodemailer/{lib → dist/esm}/mime-node/le-windows.js +6 -13
  118. package/dist/node_modules/nodemailer/dist/esm/nodemailer.d.ts +124 -0
  119. package/dist/node_modules/nodemailer/dist/esm/nodemailer.js +166 -0
  120. package/dist/node_modules/nodemailer/dist/esm/package-info.d.ts +3 -0
  121. package/dist/node_modules/nodemailer/dist/esm/package-info.js +4 -0
  122. package/dist/node_modules/nodemailer/dist/esm/package.json +3 -0
  123. package/dist/node_modules/nodemailer/dist/esm/punycode/index.d.ts +73 -0
  124. package/dist/node_modules/nodemailer/dist/esm/punycode/index.js +405 -0
  125. package/dist/node_modules/nodemailer/dist/esm/qp/index.d.ts +32 -0
  126. package/dist/node_modules/nodemailer/{lib → dist/esm}/qp/index.js +38 -67
  127. package/dist/node_modules/nodemailer/dist/esm/sendmail-transport/index.d.ts +69 -0
  128. package/dist/node_modules/nodemailer/{lib → dist/esm}/sendmail-transport/index.js +51 -101
  129. package/dist/node_modules/nodemailer/dist/esm/ses-transport/index.d.ts +112 -0
  130. package/dist/node_modules/nodemailer/dist/esm/ses-transport/index.js +212 -0
  131. package/dist/node_modules/nodemailer/dist/esm/shared/index.d.ts +260 -0
  132. package/dist/node_modules/nodemailer/{lib → dist/esm}/shared/index.js +156 -272
  133. package/dist/node_modules/nodemailer/dist/esm/shared/objects.d.ts +23 -0
  134. package/dist/node_modules/nodemailer/{lib → dist/esm}/shared/objects.js +13 -17
  135. package/dist/node_modules/nodemailer/dist/esm/shared/url.d.ts +21 -0
  136. package/dist/node_modules/nodemailer/dist/esm/shared/url.js +214 -0
  137. package/dist/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.d.ts +15 -0
  138. package/dist/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js +103 -0
  139. package/dist/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +47 -0
  140. package/dist/node_modules/nodemailer/{lib → dist/esm}/smtp-connection/http-proxy-client.js +49 -74
  141. package/dist/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +416 -0
  142. package/dist/node_modules/nodemailer/{lib → dist/esm}/smtp-connection/index.js +574 -794
  143. package/dist/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +133 -0
  144. package/dist/node_modules/nodemailer/{lib → dist/esm}/smtp-pool/index.js +172 -284
  145. package/dist/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.d.ts +62 -0
  146. package/dist/node_modules/nodemailer/{lib → dist/esm}/smtp-pool/pool-resource.js +57 -97
  147. package/dist/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +156 -0
  148. package/dist/node_modules/nodemailer/{lib → dist/esm}/smtp-transport/index.js +81 -179
  149. package/dist/node_modules/nodemailer/dist/esm/stream-transport/index.d.ts +65 -0
  150. package/dist/node_modules/nodemailer/{lib → dist/esm}/stream-transport/index.js +36 -74
  151. package/dist/node_modules/nodemailer/dist/esm/well-known/index.d.ts +35 -0
  152. package/dist/node_modules/nodemailer/{lib → dist/esm}/well-known/index.js +5 -16
  153. package/dist/node_modules/nodemailer/dist/esm/well-known/services.d.ts +2 -0
  154. package/dist/node_modules/nodemailer/dist/esm/well-known/services.js +671 -0
  155. package/dist/node_modules/nodemailer/dist/esm/xoauth2/index.d.ts +201 -0
  156. package/dist/node_modules/nodemailer/{lib → dist/esm}/xoauth2/index.js +125 -187
  157. package/dist/node_modules/nodemailer/{lib → dist}/well-known/services.json +9 -2
  158. package/dist/node_modules/nodemailer/package.json +1 -1
  159. package/package.json +3 -3
  160. package/dist/node_modules/nodemailer/.gitattributes +0 -6
  161. package/dist/node_modules/nodemailer/.ncurc.js +0 -9
  162. package/dist/node_modules/nodemailer/.prettierignore +0 -8
  163. package/dist/node_modules/nodemailer/.prettierrc +0 -12
  164. package/dist/node_modules/nodemailer/.prettierrc.js +0 -10
  165. package/dist/node_modules/nodemailer/.release-please-config.json +0 -9
  166. package/dist/node_modules/nodemailer/eslint.config.js +0 -88
  167. package/dist/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  168. package/dist/node_modules/nodemailer/lib/fetch/cookies.js +0 -276
  169. package/dist/node_modules/nodemailer/lib/mime-funcs/index.js +0 -671
  170. package/dist/node_modules/nodemailer/lib/nodemailer.js +0 -1
  171. package/dist/node_modules/nodemailer/lib/ses-transport/index.js +0 -266
  172. package/dist/node_modules/nodemailer/lib/shared/url.js +0 -151
  173. package/dist/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -105
@@ -1,23 +1,26 @@
1
1
  /* eslint no-undefined: 0 */
2
-
3
- 'use strict';
4
-
5
- const MimeNode = require('../mime-node');
6
- const mimeFuncs = require('../mime-funcs');
7
- const { parseDataURI, copyOwnKeys } = require('../shared');
8
-
2
+ import MimeNode from '../mime-node/index.js';
3
+ import * as mimeFuncs from '../mime-funcs/index.js';
4
+ import { parseDataURI, copyOwnKeys } from '../shared/index.js';
9
5
  /**
10
6
  * Creates the object for composing a MimeNode instance out from the mail options
11
7
  *
12
8
  * @constructor
13
- * @param {Object} mail Mail options
9
+ * @param mail Mail options
14
10
  */
11
+ /**
12
+ * Tells whether a content value is a content descriptor object (something to load or to
13
+ * use as is) rather than the content itself
14
+ */
15
+ function isContentObject(value) {
16
+ const content = value;
17
+ return typeof value === 'object' && !!(content.content || content.path || content.href || content.raw);
18
+ }
15
19
  class MailComposer {
16
20
  constructor(mail) {
17
21
  this.mail = mail || {};
18
22
  this.message = false;
19
23
  }
20
-
21
24
  /**
22
25
  * Builds MimeNode instance
23
26
  */
@@ -25,11 +28,9 @@ class MailComposer {
25
28
  this._alternatives = this.getAlternatives();
26
29
  this._htmlNode = this._alternatives.filter(alternative => /^text\/html\b/i.test(alternative.contentType)).pop();
27
30
  this._attachments = this.getAttachments(!!this._htmlNode);
28
-
29
31
  this._useRelated = !!(this._htmlNode && this._attachments.related.length);
30
32
  this._useAlternative = this._alternatives.length > 1;
31
33
  this._useMixed = this._attachments.attached.length > 1 || (this._alternatives.length && this._attachments.attached.length === 1);
32
-
33
34
  // Compose MIME tree
34
35
  if (this.mail.raw) {
35
36
  this.message = new MimeNode('message/rfc822', {
@@ -37,30 +38,29 @@ class MailComposer {
37
38
  disableUrlAccess: this.mail.disableUrlAccess,
38
39
  disableFileAccess: this.mail.disableFileAccess
39
40
  }).setRaw(this.mail.raw);
40
- } else if (this._useMixed) {
41
+ }
42
+ else if (this._useMixed) {
41
43
  this.message = this._createMixed();
42
- } else if (this._useAlternative) {
44
+ }
45
+ else if (this._useAlternative) {
43
46
  this.message = this._createAlternative();
44
- } else if (this._useRelated) {
47
+ }
48
+ else if (this._useRelated) {
45
49
  this.message = this._createRelated();
46
- } else {
47
- this.message = this._createContentNode(
48
- false,
49
- []
50
- .concat(this._alternatives || [])
51
- .concat(this._attachments.attached || [])
52
- .shift() || {
53
- contentType: 'text/plain',
54
- content: ''
55
- }
56
- );
57
50
  }
58
-
51
+ else {
52
+ this.message = this._createContentNode(false, []
53
+ .concat(this._alternatives || [])
54
+ .concat(this._attachments.attached || [])
55
+ .shift() || {
56
+ contentType: 'text/plain',
57
+ content: ''
58
+ });
59
+ }
59
60
  // Add custom headers
60
61
  if (this.mail.headers) {
61
62
  this.message.addHeader(this.mail.headers);
62
63
  }
63
-
64
64
  // Add headers to the root node, always overrides custom headers
65
65
  ['from', 'sender', 'to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'message-id', 'date'].forEach(header => {
66
66
  const key = header.replace(/-(\w)/g, (o, c) => c.toUpperCase());
@@ -68,105 +68,94 @@ class MailComposer {
68
68
  this.message.setHeader(header, this.mail[key]);
69
69
  }
70
70
  });
71
-
72
71
  // Sets custom envelope
73
72
  if (this.mail.envelope) {
74
73
  this.message.setEnvelope(this.mail.envelope);
75
74
  }
76
-
77
75
  // ensure Message-Id value
78
76
  this.message.messageId();
79
-
80
77
  return this.message;
81
78
  }
82
-
83
79
  /**
84
80
  * List all attachments. Resulting attachment objects can be used as input for MimeNode nodes
85
81
  *
86
- * @param {Boolean} findRelated If true separate related attachments from attached ones
87
- * @returns {Object} An object of arrays (`related` and `attached`)
82
+ * @param findRelated If true separate related attachments from attached ones
83
+ * @returns An object of arrays (`related` and `attached`)
88
84
  */
89
85
  getAttachments(findRelated) {
90
86
  let eventObject;
91
87
  const attachments = [].concat(this.mail.attachments || []).map((attachment, i) => {
92
- if (/^data:/i.test(attachment.path || attachment.href)) {
88
+ if (/^data:/i.test((attachment.path || attachment.href))) {
93
89
  attachment = this._processDataUrl(attachment);
94
90
  }
95
-
96
- const contentType =
97
- attachment.contentType || mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin');
98
-
91
+ const contentType = attachment.contentType || mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin');
99
92
  const isImage = /^image\//i.test(contentType);
100
93
  const isMessageNode = /^message\//i.test(contentType);
101
-
102
- const contentDisposition =
103
- attachment.contentDisposition || (isMessageNode || (isImage && attachment.cid) ? 'inline' : 'attachment');
104
-
94
+ const contentDisposition = attachment.contentDisposition || (isMessageNode || (isImage && attachment.cid) ? 'inline' : 'attachment');
105
95
  let contentTransferEncoding;
106
96
  if ('contentTransferEncoding' in attachment) {
107
97
  // also contains `false`, to set
108
98
  contentTransferEncoding = attachment.contentTransferEncoding;
109
- } else if (isMessageNode) {
99
+ }
100
+ else if (isMessageNode) {
110
101
  // the content might include non-ASCII bytes but at this point we do not know it yet
111
102
  contentTransferEncoding = '8bit';
112
- } else {
103
+ }
104
+ else {
113
105
  contentTransferEncoding = 'base64'; // the default
114
106
  }
115
-
116
107
  const data = {
117
108
  contentType,
118
109
  contentDisposition,
119
110
  contentTransferEncoding
120
111
  };
121
-
122
112
  if (attachment.filename) {
123
113
  data.filename = attachment.filename;
124
- } else if (!isMessageNode && attachment.filename !== false) {
125
- data.filename = (attachment.path || attachment.href || '').split('/').pop().split('?').shift() || 'attachment-' + (i + 1);
114
+ }
115
+ else if (!isMessageNode && attachment.filename !== false) {
116
+ // a backslash separates as well, so a Windows path does not put the sender's directories in the headers
117
+ data.filename =
118
+ (attachment.path || attachment.href || '').split(/[/\\]/).pop().split('?').shift() ||
119
+ 'attachment-' + (i + 1);
126
120
  if (data.filename.indexOf('.') < 0) {
127
121
  data.filename += '.' + mimeFuncs.detectExtension(data.contentType);
128
122
  }
129
123
  }
130
-
131
124
  if (/^https?:\/\//i.test(attachment.path)) {
132
125
  attachment.href = attachment.path;
133
126
  attachment.path = undefined;
134
127
  }
135
-
136
128
  if (attachment.cid) {
137
129
  data.cid = attachment.cid;
138
130
  }
139
-
140
131
  if (attachment.raw) {
141
132
  data.raw = attachment.raw;
142
- } else if (attachment.path) {
133
+ }
134
+ else if (attachment.path) {
143
135
  data.content = {
144
136
  path: attachment.path
145
137
  };
146
- } else if (attachment.href) {
138
+ }
139
+ else if (attachment.href) {
147
140
  data.content = {
148
141
  href: attachment.href,
149
142
  httpHeaders: attachment.httpHeaders,
150
143
  tls: attachment.tls
151
144
  };
152
- } else {
145
+ }
146
+ else {
153
147
  data.content = attachment.content || '';
154
148
  }
155
-
156
149
  if (attachment.encoding) {
157
150
  data.encoding = attachment.encoding;
158
151
  }
159
-
160
152
  if (attachment.headers) {
161
153
  data.headers = attachment.headers;
162
154
  }
163
-
164
155
  return data;
165
156
  });
166
-
167
157
  if (this.mail.icalEvent) {
168
158
  eventObject = Object.assign({}, this._getIcalEvent());
169
-
170
159
  eventObject.contentType = 'application/ics';
171
160
  if (!eventObject.headers) {
172
161
  eventObject.headers = {};
@@ -175,20 +164,17 @@ class MailComposer {
175
164
  eventObject.headers['Content-Disposition'] = 'attachment';
176
165
  eventObject.headers['Content-Transfer-Encoding'] = 'base64';
177
166
  }
178
-
179
167
  if (!findRelated) {
180
168
  return {
181
169
  attached: attachments.concat(eventObject || []),
182
170
  related: []
183
171
  };
184
172
  }
185
-
186
173
  return {
187
174
  attached: attachments.filter(attachment => !attachment.cid).concat(eventObject || []),
188
175
  related: attachments.filter(attachment => !!attachment.cid)
189
176
  };
190
177
  }
191
-
192
178
  /**
193
179
  * Returns the icalEvent value with `path`/`href`/data uri input normalized into
194
180
  * a `content` entry, the same way as for regular attachments. The same event is
@@ -196,33 +182,29 @@ class MailComposer {
196
182
  * attachment), so the shared content object is marked to be resolved just once
197
183
  * and the buffered result is reused by the second node.
198
184
  *
199
- * @returns {Object} Normalized icalEvent data
185
+ * @returns Normalized icalEvent data
186
+ * @internal
200
187
  */
201
188
  _getIcalEvent() {
202
189
  if (!this._icalEvent) {
203
190
  let icalEvent;
204
- if (
205
- typeof this.mail.icalEvent === 'object' &&
206
- (this.mail.icalEvent.content || this.mail.icalEvent.path || this.mail.icalEvent.href || this.mail.icalEvent.raw)
207
- ) {
191
+ if (isContentObject(this.mail.icalEvent)) {
208
192
  // an own "__proto__" key would make the copy inherit path/href from caller
209
193
  // data, and the mapping below then replaces the content the caller did set
210
194
  icalEvent = copyOwnKeys({}, this.mail.icalEvent);
211
- } else {
195
+ }
196
+ else {
212
197
  icalEvent = {
213
198
  content: this.mail.icalEvent
214
199
  };
215
200
  }
216
-
217
- if (/^data:/i.test(icalEvent.path || icalEvent.href)) {
201
+ if (/^data:/i.test((icalEvent.path || icalEvent.href))) {
218
202
  icalEvent = this._processDataUrl(icalEvent);
219
203
  }
220
-
221
204
  if (/^https?:\/\//i.test(icalEvent.path)) {
222
205
  icalEvent.href = icalEvent.path;
223
206
  icalEvent.path = undefined;
224
207
  }
225
-
226
208
  if (!icalEvent.raw) {
227
209
  // map file path and URL values into `content`, otherwise the content
228
210
  // nodes would render an empty body
@@ -231,82 +213,69 @@ class MailComposer {
231
213
  path: icalEvent.path
232
214
  };
233
215
  icalEvent.path = undefined;
234
- } else if (icalEvent.href) {
216
+ }
217
+ else if (icalEvent.href) {
235
218
  icalEvent.content = {
236
219
  href: icalEvent.href,
237
- httpHeaders: icalEvent.httpHeaders
220
+ httpHeaders: icalEvent.httpHeaders,
221
+ tls: icalEvent.tls
238
222
  };
239
223
  icalEvent.href = undefined;
240
224
  }
241
225
  }
242
-
243
226
  if (icalEvent.content && typeof icalEvent.content === 'object') {
244
227
  // we are going to have the same attachment twice, so mark this to be
245
228
  // resolved just once
246
229
  icalEvent.content._resolve = true;
247
230
  }
248
-
249
231
  this._icalEvent = icalEvent;
250
232
  }
251
-
252
233
  return this._icalEvent;
253
234
  }
254
-
255
235
  /**
256
236
  * List alternatives. Resulting objects can be used as input for MimeNode nodes
257
237
  *
258
- * @returns {Array} An array of alternative elements. Includes the `text` and `html` values as well
238
+ * @returns An array of alternative elements. Includes the `text` and `html` values as well
259
239
  */
260
240
  getAlternatives() {
261
241
  const alternatives = [];
262
242
  let text, html, watchHtml, amp, eventObject;
263
-
264
243
  if (this.mail.text) {
265
- if (
266
- typeof this.mail.text === 'object' &&
267
- (this.mail.text.content || this.mail.text.path || this.mail.text.href || this.mail.text.raw)
268
- ) {
244
+ if (isContentObject(this.mail.text)) {
269
245
  text = this.mail.text;
270
- } else {
246
+ }
247
+ else {
271
248
  text = {
272
249
  content: this.mail.text
273
250
  };
274
251
  }
275
252
  text.contentType = 'text/plain; charset=utf-8';
276
253
  }
277
-
278
254
  if (this.mail.watchHtml) {
279
- if (
280
- typeof this.mail.watchHtml === 'object' &&
281
- (this.mail.watchHtml.content || this.mail.watchHtml.path || this.mail.watchHtml.href || this.mail.watchHtml.raw)
282
- ) {
255
+ if (isContentObject(this.mail.watchHtml)) {
283
256
  watchHtml = this.mail.watchHtml;
284
- } else {
257
+ }
258
+ else {
285
259
  watchHtml = {
286
260
  content: this.mail.watchHtml
287
261
  };
288
262
  }
289
263
  watchHtml.contentType = 'text/watch-html; charset=utf-8';
290
264
  }
291
-
292
265
  if (this.mail.amp) {
293
- if (
294
- typeof this.mail.amp === 'object' &&
295
- (this.mail.amp.content || this.mail.amp.path || this.mail.amp.href || this.mail.amp.raw)
296
- ) {
266
+ if (isContentObject(this.mail.amp)) {
297
267
  amp = this.mail.amp;
298
- } else {
268
+ }
269
+ else {
299
270
  amp = {
300
271
  content: this.mail.amp
301
272
  };
302
273
  }
303
274
  amp.contentType = 'text/x-amp-html; charset=utf-8';
304
275
  }
305
-
306
276
  // NB! when including attachments with a calendar alternative you might end up in a blank screen on some clients
307
277
  if (this.mail.icalEvent) {
308
278
  eventObject = Object.assign({}, this._getIcalEvent());
309
-
310
279
  eventObject.filename = false;
311
280
  eventObject.contentType =
312
281
  'text/calendar; charset=utf-8; method=' + (eventObject.method || 'PUBLISH').toString().trim().toUpperCase();
@@ -314,21 +283,17 @@ class MailComposer {
314
283
  eventObject.headers = {};
315
284
  }
316
285
  }
317
-
318
286
  if (this.mail.html) {
319
- if (
320
- typeof this.mail.html === 'object' &&
321
- (this.mail.html.content || this.mail.html.path || this.mail.html.href || this.mail.html.raw)
322
- ) {
287
+ if (isContentObject(this.mail.html)) {
323
288
  html = this.mail.html;
324
- } else {
289
+ }
290
+ else {
325
291
  html = {
326
292
  content: this.mail.html
327
293
  };
328
294
  }
329
295
  html.contentType = 'text/html; charset=utf-8';
330
296
  }
331
-
332
297
  []
333
298
  .concat(text || [])
334
299
  .concat(watchHtml || [])
@@ -337,261 +302,237 @@ class MailComposer {
337
302
  .concat(eventObject || [])
338
303
  .concat(this.mail.alternatives || [])
339
304
  .forEach(alternative => {
340
- if (/^data:/i.test(alternative.path || alternative.href)) {
341
- alternative = this._processDataUrl(alternative);
342
- }
343
-
344
- const data = {
345
- contentType:
346
- alternative.contentType ||
347
- mimeFuncs.detectMimeType(alternative.filename || alternative.path || alternative.href || 'txt'),
348
- contentTransferEncoding: alternative.contentTransferEncoding
305
+ if (/^data:/i.test((alternative.path || alternative.href))) {
306
+ alternative = this._processDataUrl(alternative);
307
+ }
308
+ const data = {
309
+ contentType: alternative.contentType ||
310
+ mimeFuncs.detectMimeType(alternative.filename || alternative.path || alternative.href || 'txt'),
311
+ contentTransferEncoding: alternative.contentTransferEncoding
312
+ };
313
+ if (alternative.filename) {
314
+ data.filename = alternative.filename;
315
+ }
316
+ if (/^https?:\/\//i.test(alternative.path)) {
317
+ alternative.href = alternative.path;
318
+ alternative.path = undefined;
319
+ }
320
+ if (alternative.raw) {
321
+ data.raw = alternative.raw;
322
+ }
323
+ else if (alternative.path) {
324
+ data.content = {
325
+ path: alternative.path
349
326
  };
350
-
351
- if (alternative.filename) {
352
- data.filename = alternative.filename;
353
- }
354
-
355
- if (/^https?:\/\//i.test(alternative.path)) {
356
- alternative.href = alternative.path;
357
- alternative.path = undefined;
358
- }
359
-
360
- if (alternative.raw) {
361
- data.raw = alternative.raw;
362
- } else if (alternative.path) {
363
- data.content = {
364
- path: alternative.path
365
- };
366
- } else if (alternative.href) {
367
- data.content = {
368
- href: alternative.href
369
- };
370
- } else {
371
- data.content = alternative.content || '';
372
- }
373
-
374
- if (alternative.encoding) {
375
- data.encoding = alternative.encoding;
376
- }
377
-
378
- if (alternative.headers) {
379
- data.headers = alternative.headers;
380
- }
381
-
382
- alternatives.push(data);
383
- });
384
-
327
+ }
328
+ else if (alternative.href) {
329
+ data.content = {
330
+ href: alternative.href,
331
+ httpHeaders: alternative.httpHeaders,
332
+ tls: alternative.tls
333
+ };
334
+ }
335
+ else {
336
+ data.content = alternative.content || '';
337
+ }
338
+ if (alternative.encoding) {
339
+ data.encoding = alternative.encoding;
340
+ }
341
+ if (alternative.headers) {
342
+ data.headers = alternative.headers;
343
+ }
344
+ alternatives.push(data);
345
+ });
385
346
  return alternatives;
386
347
  }
387
-
388
348
  /**
389
349
  * Builds multipart/mixed node. It should always contain different type of elements on the same level
390
350
  * eg. text + attachments
391
351
  *
392
- * @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
393
- * @returns {Object} MimeNode node element
352
+ * @param parentNode Parent for this note. If it does not exist, a root node is created
353
+ * @returns MimeNode node element
354
+ * @internal
394
355
  */
395
356
  _createMixed(parentNode) {
396
357
  const node = parentNode
397
358
  ? parentNode.createChild('multipart/mixed', {
398
- disableUrlAccess: this.mail.disableUrlAccess,
399
- disableFileAccess: this.mail.disableFileAccess,
400
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
401
- newline: this.mail.newline
402
- })
359
+ disableUrlAccess: this.mail.disableUrlAccess,
360
+ disableFileAccess: this.mail.disableFileAccess,
361
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
362
+ newline: this.mail.newline
363
+ })
403
364
  : new MimeNode('multipart/mixed', {
404
- baseBoundary: this.mail.baseBoundary,
405
- textEncoding: this.mail.textEncoding,
406
- boundaryPrefix: this.mail.boundaryPrefix,
407
- disableUrlAccess: this.mail.disableUrlAccess,
408
- disableFileAccess: this.mail.disableFileAccess,
409
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
410
- newline: this.mail.newline
411
- });
412
-
365
+ baseBoundary: this.mail.baseBoundary,
366
+ textEncoding: this.mail.textEncoding,
367
+ boundaryPrefix: this.mail.boundaryPrefix,
368
+ disableUrlAccess: this.mail.disableUrlAccess,
369
+ disableFileAccess: this.mail.disableFileAccess,
370
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
371
+ newline: this.mail.newline
372
+ });
413
373
  if (this._useAlternative) {
414
374
  this._createAlternative(node);
415
- } else if (this._useRelated) {
375
+ }
376
+ else if (this._useRelated) {
416
377
  this._createRelated(node);
417
378
  }
418
-
419
379
  []
420
380
  .concat((!this._useAlternative && this._alternatives) || [])
421
381
  .concat(this._attachments.attached || [])
422
382
  .forEach(element => {
423
- // if the element is a html node from related subpart then ignore it
424
- if (!this._useRelated || element !== this._htmlNode) {
425
- this._createContentNode(node, element);
426
- }
427
- });
428
-
383
+ // if the element is a html node from related subpart then ignore it
384
+ if (!this._useRelated || element !== this._htmlNode) {
385
+ this._createContentNode(node, element);
386
+ }
387
+ });
429
388
  return node;
430
389
  }
431
-
432
390
  /**
433
391
  * Builds multipart/alternative node. It should always contain same type of elements on the same level
434
392
  * eg. text + html view of the same data
435
393
  *
436
- * @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
437
- * @returns {Object} MimeNode node element
394
+ * @param parentNode Parent for this note. If it does not exist, a root node is created
395
+ * @returns MimeNode node element
396
+ * @internal
438
397
  */
439
398
  _createAlternative(parentNode) {
440
399
  const node = parentNode
441
400
  ? parentNode.createChild('multipart/alternative', {
442
- disableUrlAccess: this.mail.disableUrlAccess,
443
- disableFileAccess: this.mail.disableFileAccess,
444
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
445
- newline: this.mail.newline
446
- })
401
+ disableUrlAccess: this.mail.disableUrlAccess,
402
+ disableFileAccess: this.mail.disableFileAccess,
403
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
404
+ newline: this.mail.newline
405
+ })
447
406
  : new MimeNode('multipart/alternative', {
448
- baseBoundary: this.mail.baseBoundary,
449
- textEncoding: this.mail.textEncoding,
450
- boundaryPrefix: this.mail.boundaryPrefix,
451
- disableUrlAccess: this.mail.disableUrlAccess,
452
- disableFileAccess: this.mail.disableFileAccess,
453
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
454
- newline: this.mail.newline
455
- });
456
-
407
+ baseBoundary: this.mail.baseBoundary,
408
+ textEncoding: this.mail.textEncoding,
409
+ boundaryPrefix: this.mail.boundaryPrefix,
410
+ disableUrlAccess: this.mail.disableUrlAccess,
411
+ disableFileAccess: this.mail.disableFileAccess,
412
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
413
+ newline: this.mail.newline
414
+ });
457
415
  this._alternatives.forEach(alternative => {
458
416
  if (this._useRelated && this._htmlNode === alternative) {
459
417
  this._createRelated(node);
460
- } else {
418
+ }
419
+ else {
461
420
  this._createContentNode(node, alternative);
462
421
  }
463
422
  });
464
-
465
423
  return node;
466
424
  }
467
-
468
425
  /**
469
426
  * Builds multipart/related node. It should always contain html node with related attachments
470
427
  *
471
- * @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
472
- * @returns {Object} MimeNode node element
428
+ * @param parentNode Parent for this note. If it does not exist, a root node is created
429
+ * @returns MimeNode node element
430
+ * @internal
473
431
  */
474
432
  _createRelated(parentNode) {
475
433
  const node = parentNode
476
434
  ? parentNode.createChild('multipart/related; type="text/html"', {
477
- disableUrlAccess: this.mail.disableUrlAccess,
478
- disableFileAccess: this.mail.disableFileAccess,
479
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
480
- newline: this.mail.newline
481
- })
435
+ disableUrlAccess: this.mail.disableUrlAccess,
436
+ disableFileAccess: this.mail.disableFileAccess,
437
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
438
+ newline: this.mail.newline
439
+ })
482
440
  : new MimeNode('multipart/related; type="text/html"', {
483
- baseBoundary: this.mail.baseBoundary,
484
- textEncoding: this.mail.textEncoding,
485
- boundaryPrefix: this.mail.boundaryPrefix,
486
- disableUrlAccess: this.mail.disableUrlAccess,
487
- disableFileAccess: this.mail.disableFileAccess,
488
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
489
- newline: this.mail.newline
490
- });
491
-
441
+ baseBoundary: this.mail.baseBoundary,
442
+ textEncoding: this.mail.textEncoding,
443
+ boundaryPrefix: this.mail.boundaryPrefix,
444
+ disableUrlAccess: this.mail.disableUrlAccess,
445
+ disableFileAccess: this.mail.disableFileAccess,
446
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
447
+ newline: this.mail.newline
448
+ });
492
449
  this._createContentNode(node, this._htmlNode);
493
-
494
450
  this._attachments.related.forEach(alternative => this._createContentNode(node, alternative));
495
-
496
451
  return node;
497
452
  }
498
-
499
453
  /**
500
454
  * Creates a regular node with contents
501
455
  *
502
- * @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
503
- * @param {Object} element Node data
504
- * @returns {Object} MimeNode node element
456
+ * @param parentNode Parent for this note. If it does not exist, a root node is created
457
+ * @param element Node data
458
+ * @returns MimeNode node element
459
+ * @internal
505
460
  */
506
461
  _createContentNode(parentNode, element) {
507
462
  element = element || {};
508
463
  element.content = element.content || '';
509
-
510
464
  const encoding = (element.encoding || 'utf8')
511
465
  .toString()
512
466
  .toLowerCase()
513
467
  .replace(/[-_\s]/g, '');
514
-
515
468
  const node = parentNode
516
469
  ? parentNode.createChild(element.contentType, {
517
- filename: element.filename,
518
- textEncoding: this.mail.textEncoding,
519
- disableUrlAccess: this.mail.disableUrlAccess,
520
- disableFileAccess: this.mail.disableFileAccess,
521
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
522
- newline: this.mail.newline
523
- })
470
+ filename: element.filename,
471
+ textEncoding: this.mail.textEncoding,
472
+ disableUrlAccess: this.mail.disableUrlAccess,
473
+ disableFileAccess: this.mail.disableFileAccess,
474
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
475
+ newline: this.mail.newline
476
+ })
524
477
  : new MimeNode(element.contentType, {
525
- filename: element.filename,
526
- baseBoundary: this.mail.baseBoundary,
527
- textEncoding: this.mail.textEncoding,
528
- boundaryPrefix: this.mail.boundaryPrefix,
529
- disableUrlAccess: this.mail.disableUrlAccess,
530
- disableFileAccess: this.mail.disableFileAccess,
531
- normalizeHeaderKey: this.mail.normalizeHeaderKey,
532
- newline: this.mail.newline
533
- });
534
-
478
+ filename: element.filename,
479
+ baseBoundary: this.mail.baseBoundary,
480
+ textEncoding: this.mail.textEncoding,
481
+ boundaryPrefix: this.mail.boundaryPrefix,
482
+ disableUrlAccess: this.mail.disableUrlAccess,
483
+ disableFileAccess: this.mail.disableFileAccess,
484
+ normalizeHeaderKey: this.mail.normalizeHeaderKey,
485
+ newline: this.mail.newline
486
+ });
535
487
  // add custom headers
536
488
  if (element.headers) {
537
489
  node.addHeader(element.headers);
538
490
  }
539
-
540
491
  if (element.cid) {
541
492
  node.setHeader('Content-Id', '<' + element.cid.replace(/[<>]/g, '') + '>');
542
493
  }
543
-
544
494
  if (element.contentTransferEncoding) {
545
495
  node.setHeader('Content-Transfer-Encoding', element.contentTransferEncoding);
546
- } else if (this.mail.encoding && /^text\//i.test(element.contentType)) {
496
+ }
497
+ else if (this.mail.encoding && /^text\//i.test(element.contentType)) {
547
498
  node.setHeader('Content-Transfer-Encoding', this.mail.encoding);
548
499
  }
549
-
550
500
  if (!/^text\//i.test(element.contentType) || element.contentDisposition) {
551
- node.setHeader(
552
- 'Content-Disposition',
553
- element.contentDisposition || (element.cid && /^image\//i.test(element.contentType) ? 'inline' : 'attachment')
554
- );
501
+ node.setHeader('Content-Disposition', element.contentDisposition || (element.cid && /^image\//i.test(element.contentType) ? 'inline' : 'attachment'));
555
502
  }
556
-
557
503
  if (typeof element.content === 'string' && !['utf8', 'usascii', 'ascii'].includes(encoding)) {
558
504
  element.content = Buffer.from(element.content, encoding);
559
505
  }
560
-
561
506
  // prefer pregenerated raw content
562
507
  if (element.raw) {
563
508
  node.setRaw(element.raw);
564
- } else {
509
+ }
510
+ else {
565
511
  node.setContent(element.content);
566
512
  }
567
-
568
513
  return node;
569
514
  }
570
-
571
515
  /**
572
516
  * Parses data uri and converts it to a Buffer
573
517
  *
574
- * @param {Object} element Content element
575
- * @return {Object} Parsed element
518
+ * @param element Content element
519
+ * @return Parsed element
520
+ * @internal
576
521
  */
577
522
  _processDataUrl(element) {
578
523
  const dataUrl = element.path || element.href;
579
-
580
524
  // Early validation to prevent ReDoS
581
525
  if (!dataUrl || typeof dataUrl !== 'string') {
582
526
  return element;
583
527
  }
584
-
585
528
  if (!dataUrl.startsWith('data:')) {
586
529
  return element;
587
530
  }
588
-
589
531
  if (dataUrl.length > 52428800) {
590
532
  // 52428800 chars = 50MB limit for data URL string (~37.5MB decoded image)
591
533
  // Extract content type before rejecting to preserve MIME type
592
534
  let detectedType = 'application/octet-stream';
593
535
  const commaPos = dataUrl.indexOf(',');
594
-
595
536
  if (commaPos > 0 && commaPos < 200) {
596
537
  // Parse header safely with size limit
597
538
  const header = dataUrl.substring(5, commaPos); // skip 'data:'
@@ -600,7 +541,6 @@ class MailComposer {
600
541
  detectedType = parts[0].trim();
601
542
  }
602
543
  }
603
-
604
544
  // Return empty content for excessively long data URLs
605
545
  return Object.assign(copyOwnKeys({}, element), {
606
546
  path: false,
@@ -609,31 +549,25 @@ class MailComposer {
609
549
  contentType: element.contentType || detectedType
610
550
  });
611
551
  }
612
-
613
552
  let parsedDataUri;
614
553
  try {
615
554
  parsedDataUri = parseDataURI(dataUrl);
616
- } catch (_err) {
555
+ }
556
+ catch (_err) {
617
557
  return element;
618
558
  }
619
-
620
559
  if (!parsedDataUri) {
621
560
  return element;
622
561
  }
623
-
624
562
  element.content = parsedDataUri.data;
625
563
  element.contentType = element.contentType || parsedDataUri.contentType;
626
-
627
564
  if ('path' in element) {
628
565
  element.path = false;
629
566
  }
630
-
631
567
  if ('href' in element) {
632
568
  element.href = false;
633
569
  }
634
-
635
570
  return element;
636
571
  }
637
572
  }
638
-
639
- module.exports = MailComposer;
573
+ export default MailComposer;