@nocobase/plugin-workflow-mailer 1.0.1-alpha.3

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 (64) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +9 -0
  3. package/README.zh-CN.md +9 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/MailerInstruction.d.ts +352 -0
  7. package/dist/client/index.d.ts +14 -0
  8. package/dist/client/index.js +16 -0
  9. package/dist/externalVersion.js +16 -0
  10. package/dist/index.d.ts +10 -0
  11. package/dist/index.js +48 -0
  12. package/dist/locale/en-US.json +19 -0
  13. package/dist/locale/index.d.ts +11 -0
  14. package/dist/locale/index.js +48 -0
  15. package/dist/locale/zh-CN.json +19 -0
  16. package/dist/node_modules/nodemailer/.gitattributes +6 -0
  17. package/dist/node_modules/nodemailer/.ncurc.js +7 -0
  18. package/dist/node_modules/nodemailer/.prettierrc.js +8 -0
  19. package/dist/node_modules/nodemailer/LICENSE +16 -0
  20. package/dist/node_modules/nodemailer/SECURITY.txt +22 -0
  21. package/dist/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  22. package/dist/node_modules/nodemailer/lib/base64/index.js +142 -0
  23. package/dist/node_modules/nodemailer/lib/dkim/index.js +251 -0
  24. package/dist/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  25. package/dist/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  26. package/dist/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  27. package/dist/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  28. package/dist/node_modules/nodemailer/lib/fetch/index.js +274 -0
  29. package/dist/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  30. package/dist/node_modules/nodemailer/lib/mail-composer/index.js +565 -0
  31. package/dist/node_modules/nodemailer/lib/mailer/index.js +429 -0
  32. package/dist/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  33. package/dist/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
  34. package/dist/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  35. package/dist/node_modules/nodemailer/lib/mime-node/index.js +1314 -0
  36. package/dist/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  37. package/dist/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  38. package/dist/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  39. package/dist/node_modules/nodemailer/lib/nodemailer.js +1 -0
  40. package/dist/node_modules/nodemailer/lib/punycode/index.js +460 -0
  41. package/dist/node_modules/nodemailer/lib/qp/index.js +219 -0
  42. package/dist/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  43. package/dist/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
  44. package/dist/node_modules/nodemailer/lib/shared/index.js +688 -0
  45. package/dist/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  46. package/dist/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  47. package/dist/node_modules/nodemailer/lib/smtp-connection/index.js +1825 -0
  48. package/dist/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
  49. package/dist/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
  50. package/dist/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
  51. package/dist/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  52. package/dist/node_modules/nodemailer/lib/well-known/index.js +47 -0
  53. package/dist/node_modules/nodemailer/lib/well-known/services.json +343 -0
  54. package/dist/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
  55. package/dist/node_modules/nodemailer/package.json +1 -0
  56. package/dist/server/MailerInstruction.d.ts +13 -0
  57. package/dist/server/MailerInstruction.js +118 -0
  58. package/dist/server/Plugin.d.ts +12 -0
  59. package/dist/server/Plugin.js +50 -0
  60. package/dist/server/index.d.ts +9 -0
  61. package/dist/server/index.js +42 -0
  62. package/package.json +33 -0
  63. package/server.d.ts +2 -0
  64. package/server.js +1 -0
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ const packageData = require('../../package.json');
4
+ const shared = require('../shared');
5
+
6
+ /**
7
+ * Generates a Transport object for streaming
8
+ *
9
+ * Possible options can be the following:
10
+ *
11
+ * * **buffer** if true, then returns the message as a Buffer object instead of a stream
12
+ * * **newline** either 'windows' or 'unix'
13
+ *
14
+ * @constructor
15
+ * @param {Object} optional config parameter
16
+ */
17
+ class StreamTransport {
18
+ constructor(options) {
19
+ options = options || {};
20
+
21
+ this.options = options || {};
22
+
23
+ this.name = 'StreamTransport';
24
+ this.version = packageData.version;
25
+
26
+ this.logger = shared.getLogger(this.options, {
27
+ component: this.options.component || 'stream-transport'
28
+ });
29
+
30
+ this.winbreak = ['win', 'windows', 'dos', '\r\n'].includes((options.newline || '').toString().toLowerCase());
31
+ }
32
+
33
+ /**
34
+ * Compiles a mailcomposer message and forwards it to handler that sends it
35
+ *
36
+ * @param {Object} emailMessage MailComposer object
37
+ * @param {Function} callback Callback function to run when the sending is completed
38
+ */
39
+ send(mail, done) {
40
+ // We probably need this in the output
41
+ mail.message.keepBcc = true;
42
+
43
+ let envelope = mail.data.envelope || mail.message.getEnvelope();
44
+ let messageId = mail.message.messageId();
45
+
46
+ let recipients = [].concat(envelope.to || []);
47
+ if (recipients.length > 3) {
48
+ recipients.push('...and ' + recipients.splice(2).length + ' more');
49
+ }
50
+ this.logger.info(
51
+ {
52
+ tnx: 'send',
53
+ messageId
54
+ },
55
+ 'Sending message %s to <%s> using %s line breaks',
56
+ messageId,
57
+ recipients.join(', '),
58
+ this.winbreak ? '<CR><LF>' : '<LF>'
59
+ );
60
+
61
+ setImmediate(() => {
62
+ let stream;
63
+
64
+ try {
65
+ stream = mail.message.createReadStream();
66
+ } catch (E) {
67
+ this.logger.error(
68
+ {
69
+ err: E,
70
+ tnx: 'send',
71
+ messageId
72
+ },
73
+ 'Creating send stream failed for %s. %s',
74
+ messageId,
75
+ E.message
76
+ );
77
+ return done(E);
78
+ }
79
+
80
+ if (!this.options.buffer) {
81
+ stream.once('error', err => {
82
+ this.logger.error(
83
+ {
84
+ err,
85
+ tnx: 'send',
86
+ messageId
87
+ },
88
+ 'Failed creating message for %s. %s',
89
+ messageId,
90
+ err.message
91
+ );
92
+ });
93
+ return done(null, {
94
+ envelope: mail.data.envelope || mail.message.getEnvelope(),
95
+ messageId,
96
+ message: stream
97
+ });
98
+ }
99
+
100
+ let chunks = [];
101
+ let chunklen = 0;
102
+ stream.on('readable', () => {
103
+ let chunk;
104
+ while ((chunk = stream.read()) !== null) {
105
+ chunks.push(chunk);
106
+ chunklen += chunk.length;
107
+ }
108
+ });
109
+
110
+ stream.once('error', err => {
111
+ this.logger.error(
112
+ {
113
+ err,
114
+ tnx: 'send',
115
+ messageId
116
+ },
117
+ 'Failed creating message for %s. %s',
118
+ messageId,
119
+ err.message
120
+ );
121
+ return done(err);
122
+ });
123
+
124
+ stream.on('end', () =>
125
+ done(null, {
126
+ envelope: mail.data.envelope || mail.message.getEnvelope(),
127
+ messageId,
128
+ message: Buffer.concat(chunks, chunklen)
129
+ })
130
+ );
131
+ });
132
+ }
133
+ }
134
+
135
+ module.exports = StreamTransport;
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ const services = require('./services.json');
4
+ const normalized = {};
5
+
6
+ Object.keys(services).forEach(key => {
7
+ let service = services[key];
8
+
9
+ normalized[normalizeKey(key)] = normalizeService(service);
10
+
11
+ [].concat(service.aliases || []).forEach(alias => {
12
+ normalized[normalizeKey(alias)] = normalizeService(service);
13
+ });
14
+
15
+ [].concat(service.domains || []).forEach(domain => {
16
+ normalized[normalizeKey(domain)] = normalizeService(service);
17
+ });
18
+ });
19
+
20
+ function normalizeKey(key) {
21
+ return key.replace(/[^a-zA-Z0-9.-]/g, '').toLowerCase();
22
+ }
23
+
24
+ function normalizeService(service) {
25
+ let filter = ['domains', 'aliases'];
26
+ let response = {};
27
+
28
+ Object.keys(service).forEach(key => {
29
+ if (filter.indexOf(key) < 0) {
30
+ response[key] = service[key];
31
+ }
32
+ });
33
+
34
+ return response;
35
+ }
36
+
37
+ /**
38
+ * Resolves SMTP config for given key. Key can be a name (like 'Gmail'), alias (like 'Google Mail') or
39
+ * an email address (like 'test@googlemail.com').
40
+ *
41
+ * @param {String} key [description]
42
+ * @returns {Object} SMTP config or false if not found
43
+ */
44
+ module.exports = function (key) {
45
+ key = normalizeKey(key.split('@').pop());
46
+ return normalized[key] || false;
47
+ };
@@ -0,0 +1,343 @@
1
+ {
2
+ "1und1": {
3
+ "host": "smtp.1und1.de",
4
+ "port": 465,
5
+ "secure": true,
6
+ "authMethod": "LOGIN"
7
+ },
8
+
9
+ "Aliyun": {
10
+ "domains": ["aliyun.com"],
11
+ "host": "smtp.aliyun.com",
12
+ "port": 465,
13
+ "secure": true
14
+ },
15
+
16
+ "AOL": {
17
+ "domains": ["aol.com"],
18
+ "host": "smtp.aol.com",
19
+ "port": 587
20
+ },
21
+
22
+ "Bluewin": {
23
+ "host": "smtpauths.bluewin.ch",
24
+ "domains": ["bluewin.ch"],
25
+ "port": 465
26
+ },
27
+
28
+ "DebugMail": {
29
+ "host": "debugmail.io",
30
+ "port": 25
31
+ },
32
+
33
+ "DynectEmail": {
34
+ "aliases": ["Dynect"],
35
+ "host": "smtp.dynect.net",
36
+ "port": 25
37
+ },
38
+
39
+ "Ethereal": {
40
+ "aliases": ["ethereal.email"],
41
+ "host": "smtp.ethereal.email",
42
+ "port": 587
43
+ },
44
+
45
+ "FastMail": {
46
+ "domains": ["fastmail.fm"],
47
+ "host": "smtp.fastmail.com",
48
+ "port": 465,
49
+ "secure": true
50
+ },
51
+
52
+ "Forward Email": {
53
+ "aliases": ["FE", "ForwardEmail"],
54
+ "domains": ["forwardemail.net"],
55
+ "host": "smtp.forwardemail.net",
56
+ "port": 465,
57
+ "secure": true
58
+ },
59
+
60
+ "GandiMail": {
61
+ "aliases": ["Gandi", "Gandi Mail"],
62
+ "host": "mail.gandi.net",
63
+ "port": 587
64
+ },
65
+
66
+ "Gmail": {
67
+ "aliases": ["Google Mail"],
68
+ "domains": ["gmail.com", "googlemail.com"],
69
+ "host": "smtp.gmail.com",
70
+ "port": 465,
71
+ "secure": true
72
+ },
73
+
74
+ "Godaddy": {
75
+ "host": "smtpout.secureserver.net",
76
+ "port": 25
77
+ },
78
+
79
+ "GodaddyAsia": {
80
+ "host": "smtp.asia.secureserver.net",
81
+ "port": 25
82
+ },
83
+
84
+ "GodaddyEurope": {
85
+ "host": "smtp.europe.secureserver.net",
86
+ "port": 25
87
+ },
88
+
89
+ "hot.ee": {
90
+ "host": "mail.hot.ee"
91
+ },
92
+
93
+ "Hotmail": {
94
+ "aliases": ["Outlook", "Outlook.com", "Hotmail.com"],
95
+ "domains": ["hotmail.com", "outlook.com"],
96
+ "host": "smtp-mail.outlook.com",
97
+ "port": 587
98
+ },
99
+
100
+ "iCloud": {
101
+ "aliases": ["Me", "Mac"],
102
+ "domains": ["me.com", "mac.com"],
103
+ "host": "smtp.mail.me.com",
104
+ "port": 587
105
+ },
106
+
107
+ "Infomaniak": {
108
+ "host": "mail.infomaniak.com",
109
+ "domains": ["ik.me", "ikmail.com", "etik.com"],
110
+ "port": 587
111
+ },
112
+
113
+ "mail.ee": {
114
+ "host": "smtp.mail.ee"
115
+ },
116
+
117
+ "Mail.ru": {
118
+ "host": "smtp.mail.ru",
119
+ "port": 465,
120
+ "secure": true
121
+ },
122
+
123
+ "Mailcatch.app": {
124
+ "host": "sandbox-smtp.mailcatch.app",
125
+ "port": 2525
126
+ },
127
+
128
+ "Maildev": {
129
+ "port": 1025,
130
+ "ignoreTLS": true
131
+ },
132
+
133
+ "Mailgun": {
134
+ "host": "smtp.mailgun.org",
135
+ "port": 465,
136
+ "secure": true
137
+ },
138
+
139
+ "Mailjet": {
140
+ "host": "in.mailjet.com",
141
+ "port": 587
142
+ },
143
+
144
+ "Mailosaur": {
145
+ "host": "mailosaur.io",
146
+ "port": 25
147
+ },
148
+
149
+ "Mailtrap": {
150
+ "host": "smtp.mailtrap.io",
151
+ "port": 2525
152
+ },
153
+
154
+ "Mandrill": {
155
+ "host": "smtp.mandrillapp.com",
156
+ "port": 587
157
+ },
158
+
159
+ "Naver": {
160
+ "host": "smtp.naver.com",
161
+ "port": 587
162
+ },
163
+
164
+ "One": {
165
+ "host": "send.one.com",
166
+ "port": 465,
167
+ "secure": true
168
+ },
169
+
170
+ "OpenMailBox": {
171
+ "aliases": ["OMB", "openmailbox.org"],
172
+ "host": "smtp.openmailbox.org",
173
+ "port": 465,
174
+ "secure": true
175
+ },
176
+
177
+ "Outlook365": {
178
+ "host": "smtp.office365.com",
179
+ "port": 587,
180
+ "secure": false
181
+ },
182
+
183
+ "OhMySMTP": {
184
+ "host": "smtp.ohmysmtp.com",
185
+ "port": 587,
186
+ "secure": false
187
+ },
188
+
189
+ "Postmark": {
190
+ "aliases": ["PostmarkApp"],
191
+ "host": "smtp.postmarkapp.com",
192
+ "port": 2525
193
+ },
194
+
195
+ "qiye.aliyun": {
196
+ "host": "smtp.mxhichina.com",
197
+ "port": "465",
198
+ "secure": true
199
+ },
200
+
201
+ "QQ": {
202
+ "domains": ["qq.com"],
203
+ "host": "smtp.qq.com",
204
+ "port": 465,
205
+ "secure": true
206
+ },
207
+
208
+ "QQex": {
209
+ "aliases": ["QQ Enterprise"],
210
+ "domains": ["exmail.qq.com"],
211
+ "host": "smtp.exmail.qq.com",
212
+ "port": 465,
213
+ "secure": true
214
+ },
215
+
216
+ "SendCloud": {
217
+ "host": "smtp.sendcloud.net",
218
+ "port": 2525
219
+ },
220
+
221
+ "SendGrid": {
222
+ "host": "smtp.sendgrid.net",
223
+ "port": 587
224
+ },
225
+
226
+ "SendinBlue": {
227
+ "aliases": ["Brevo"],
228
+ "host": "smtp-relay.brevo.com",
229
+ "port": 587
230
+ },
231
+
232
+ "SendPulse": {
233
+ "host": "smtp-pulse.com",
234
+ "port": 465,
235
+ "secure": true
236
+ },
237
+
238
+ "SES": {
239
+ "host": "email-smtp.us-east-1.amazonaws.com",
240
+ "port": 465,
241
+ "secure": true
242
+ },
243
+
244
+ "SES-US-EAST-1": {
245
+ "host": "email-smtp.us-east-1.amazonaws.com",
246
+ "port": 465,
247
+ "secure": true
248
+ },
249
+
250
+ "SES-US-WEST-2": {
251
+ "host": "email-smtp.us-west-2.amazonaws.com",
252
+ "port": 465,
253
+ "secure": true
254
+ },
255
+
256
+ "SES-EU-WEST-1": {
257
+ "host": "email-smtp.eu-west-1.amazonaws.com",
258
+ "port": 465,
259
+ "secure": true
260
+ },
261
+
262
+ "SES-AP-SOUTH-1": {
263
+ "host": "email-smtp.ap-south-1.amazonaws.com",
264
+ "port": 465,
265
+ "secure": true
266
+ },
267
+
268
+ "SES-AP-NORTHEAST-1": {
269
+ "host": "email-smtp.ap-northeast-1.amazonaws.com",
270
+ "port": 465,
271
+ "secure": true
272
+ },
273
+
274
+ "SES-AP-NORTHEAST-2": {
275
+ "host": "email-smtp.ap-northeast-2.amazonaws.com",
276
+ "port": 465,
277
+ "secure": true
278
+ },
279
+
280
+ "SES-AP-NORTHEAST-3": {
281
+ "host": "email-smtp.ap-northeast-3.amazonaws.com",
282
+ "port": 465,
283
+ "secure": true
284
+ },
285
+
286
+ "SES-AP-SOUTHEAST-1": {
287
+ "host": "email-smtp.ap-southeast-1.amazonaws.com",
288
+ "port": 465,
289
+ "secure": true
290
+ },
291
+
292
+ "SES-AP-SOUTHEAST-2": {
293
+ "host": "email-smtp.ap-southeast-2.amazonaws.com",
294
+ "port": 465,
295
+ "secure": true
296
+ },
297
+
298
+ "Sparkpost": {
299
+ "aliases": ["SparkPost", "SparkPost Mail"],
300
+ "domains": ["sparkpost.com"],
301
+ "host": "smtp.sparkpostmail.com",
302
+ "port": 587,
303
+ "secure": false
304
+ },
305
+
306
+ "Tipimail": {
307
+ "host": "smtp.tipimail.com",
308
+ "port": 587
309
+ },
310
+
311
+ "Yahoo": {
312
+ "domains": ["yahoo.com"],
313
+ "host": "smtp.mail.yahoo.com",
314
+ "port": 465,
315
+ "secure": true
316
+ },
317
+
318
+ "Yandex": {
319
+ "domains": ["yandex.ru"],
320
+ "host": "smtp.yandex.ru",
321
+ "port": 465,
322
+ "secure": true
323
+ },
324
+
325
+ "Zoho": {
326
+ "host": "smtp.zoho.com",
327
+ "port": 465,
328
+ "secure": true,
329
+ "authMethod": "LOGIN"
330
+ },
331
+
332
+ "126": {
333
+ "host": "smtp.126.com",
334
+ "port": 465,
335
+ "secure": true
336
+ },
337
+
338
+ "163": {
339
+ "host": "smtp.163.com",
340
+ "port": 465,
341
+ "secure": true
342
+ }
343
+ }