@nocobase/plugin-notification-email 1.4.0-alpha.20240928155737

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 (65) hide show
  1. package/LICENSE.txt +123 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/ConfigForm.d.ts +10 -0
  6. package/dist/client/MessageConfigForm.d.ts +12 -0
  7. package/dist/client/hooks/useTranslation.d.ts +9 -0
  8. package/dist/client/index.d.ts +15 -0
  9. package/dist/client/index.js +16 -0
  10. package/dist/constant.d.ts +10 -0
  11. package/dist/constant.js +39 -0
  12. package/dist/externalVersion.js +17 -0
  13. package/dist/index.d.ts +10 -0
  14. package/dist/index.js +48 -0
  15. package/dist/locale/en-US.json +22 -0
  16. package/dist/locale/zh-CN.json +22 -0
  17. package/dist/node_modules/nodemailer/.gitattributes +6 -0
  18. package/dist/node_modules/nodemailer/.ncurc.js +7 -0
  19. package/dist/node_modules/nodemailer/.prettierrc.js +8 -0
  20. package/dist/node_modules/nodemailer/LICENSE +16 -0
  21. package/dist/node_modules/nodemailer/SECURITY.txt +22 -0
  22. package/dist/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  23. package/dist/node_modules/nodemailer/lib/base64/index.js +142 -0
  24. package/dist/node_modules/nodemailer/lib/dkim/index.js +251 -0
  25. package/dist/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  26. package/dist/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  27. package/dist/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  28. package/dist/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  29. package/dist/node_modules/nodemailer/lib/fetch/index.js +274 -0
  30. package/dist/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  31. package/dist/node_modules/nodemailer/lib/mail-composer/index.js +565 -0
  32. package/dist/node_modules/nodemailer/lib/mailer/index.js +427 -0
  33. package/dist/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  34. package/dist/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
  35. package/dist/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  36. package/dist/node_modules/nodemailer/lib/mime-node/index.js +1305 -0
  37. package/dist/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  38. package/dist/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  39. package/dist/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  40. package/dist/node_modules/nodemailer/lib/nodemailer.js +1 -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 +638 -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 +1812 -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 +338 -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/index.d.ts +9 -0
  57. package/dist/server/index.js +42 -0
  58. package/dist/server/mail-server.d.ts +14 -0
  59. package/dist/server/mail-server.js +78 -0
  60. package/dist/server/plugin.d.ts +19 -0
  61. package/dist/server/plugin.js +69 -0
  62. package/package.json +23 -0
  63. package/server.d.ts +2 -0
  64. package/server.js +1 -0
  65. package/tsconfig.json +7 -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,338 @@
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
+ "Maildev": {
124
+ "port": 1025,
125
+ "ignoreTLS": true
126
+ },
127
+
128
+ "Mailgun": {
129
+ "host": "smtp.mailgun.org",
130
+ "port": 465,
131
+ "secure": true
132
+ },
133
+
134
+ "Mailjet": {
135
+ "host": "in.mailjet.com",
136
+ "port": 587
137
+ },
138
+
139
+ "Mailosaur": {
140
+ "host": "mailosaur.io",
141
+ "port": 25
142
+ },
143
+
144
+ "Mailtrap": {
145
+ "host": "smtp.mailtrap.io",
146
+ "port": 2525
147
+ },
148
+
149
+ "Mandrill": {
150
+ "host": "smtp.mandrillapp.com",
151
+ "port": 587
152
+ },
153
+
154
+ "Naver": {
155
+ "host": "smtp.naver.com",
156
+ "port": 587
157
+ },
158
+
159
+ "One": {
160
+ "host": "send.one.com",
161
+ "port": 465,
162
+ "secure": true
163
+ },
164
+
165
+ "OpenMailBox": {
166
+ "aliases": ["OMB", "openmailbox.org"],
167
+ "host": "smtp.openmailbox.org",
168
+ "port": 465,
169
+ "secure": true
170
+ },
171
+
172
+ "Outlook365": {
173
+ "host": "smtp.office365.com",
174
+ "port": 587,
175
+ "secure": false
176
+ },
177
+
178
+ "OhMySMTP": {
179
+ "host": "smtp.ohmysmtp.com",
180
+ "port": 587,
181
+ "secure": false
182
+ },
183
+
184
+ "Postmark": {
185
+ "aliases": ["PostmarkApp"],
186
+ "host": "smtp.postmarkapp.com",
187
+ "port": 2525
188
+ },
189
+
190
+ "qiye.aliyun": {
191
+ "host": "smtp.mxhichina.com",
192
+ "port": "465",
193
+ "secure": true
194
+ },
195
+
196
+ "QQ": {
197
+ "domains": ["qq.com"],
198
+ "host": "smtp.qq.com",
199
+ "port": 465,
200
+ "secure": true
201
+ },
202
+
203
+ "QQex": {
204
+ "aliases": ["QQ Enterprise"],
205
+ "domains": ["exmail.qq.com"],
206
+ "host": "smtp.exmail.qq.com",
207
+ "port": 465,
208
+ "secure": true
209
+ },
210
+
211
+ "SendCloud": {
212
+ "host": "smtp.sendcloud.net",
213
+ "port": 2525
214
+ },
215
+
216
+ "SendGrid": {
217
+ "host": "smtp.sendgrid.net",
218
+ "port": 587
219
+ },
220
+
221
+ "SendinBlue": {
222
+ "aliases": ["Brevo"],
223
+ "host": "smtp-relay.brevo.com",
224
+ "port": 587
225
+ },
226
+
227
+ "SendPulse": {
228
+ "host": "smtp-pulse.com",
229
+ "port": 465,
230
+ "secure": true
231
+ },
232
+
233
+ "SES": {
234
+ "host": "email-smtp.us-east-1.amazonaws.com",
235
+ "port": 465,
236
+ "secure": true
237
+ },
238
+
239
+ "SES-US-EAST-1": {
240
+ "host": "email-smtp.us-east-1.amazonaws.com",
241
+ "port": 465,
242
+ "secure": true
243
+ },
244
+
245
+ "SES-US-WEST-2": {
246
+ "host": "email-smtp.us-west-2.amazonaws.com",
247
+ "port": 465,
248
+ "secure": true
249
+ },
250
+
251
+ "SES-EU-WEST-1": {
252
+ "host": "email-smtp.eu-west-1.amazonaws.com",
253
+ "port": 465,
254
+ "secure": true
255
+ },
256
+
257
+ "SES-AP-SOUTH-1": {
258
+ "host": "email-smtp.ap-south-1.amazonaws.com",
259
+ "port": 465,
260
+ "secure": true
261
+ },
262
+
263
+ "SES-AP-NORTHEAST-1": {
264
+ "host": "email-smtp.ap-northeast-1.amazonaws.com",
265
+ "port": 465,
266
+ "secure": true
267
+ },
268
+
269
+ "SES-AP-NORTHEAST-2": {
270
+ "host": "email-smtp.ap-northeast-2.amazonaws.com",
271
+ "port": 465,
272
+ "secure": true
273
+ },
274
+
275
+ "SES-AP-NORTHEAST-3": {
276
+ "host": "email-smtp.ap-northeast-3.amazonaws.com",
277
+ "port": 465,
278
+ "secure": true
279
+ },
280
+
281
+ "SES-AP-SOUTHEAST-1": {
282
+ "host": "email-smtp.ap-southeast-1.amazonaws.com",
283
+ "port": 465,
284
+ "secure": true
285
+ },
286
+
287
+ "SES-AP-SOUTHEAST-2": {
288
+ "host": "email-smtp.ap-southeast-2.amazonaws.com",
289
+ "port": 465,
290
+ "secure": true
291
+ },
292
+
293
+ "Sparkpost": {
294
+ "aliases": ["SparkPost", "SparkPost Mail"],
295
+ "domains": ["sparkpost.com"],
296
+ "host": "smtp.sparkpostmail.com",
297
+ "port": 587,
298
+ "secure": false
299
+ },
300
+
301
+ "Tipimail": {
302
+ "host": "smtp.tipimail.com",
303
+ "port": 587
304
+ },
305
+
306
+ "Yahoo": {
307
+ "domains": ["yahoo.com"],
308
+ "host": "smtp.mail.yahoo.com",
309
+ "port": 465,
310
+ "secure": true
311
+ },
312
+
313
+ "Yandex": {
314
+ "domains": ["yandex.ru"],
315
+ "host": "smtp.yandex.ru",
316
+ "port": 465,
317
+ "secure": true
318
+ },
319
+
320
+ "Zoho": {
321
+ "host": "smtp.zoho.com",
322
+ "port": 465,
323
+ "secure": true,
324
+ "authMethod": "LOGIN"
325
+ },
326
+
327
+ "126": {
328
+ "host": "smtp.126.com",
329
+ "port": 465,
330
+ "secure": true
331
+ },
332
+
333
+ "163": {
334
+ "host": "smtp.163.com",
335
+ "port": 465,
336
+ "secure": true
337
+ }
338
+ }