packlab5 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/06-02.html +81 -0
  2. package/06-02.js +72 -0
  3. package/06-03.js +7 -0
  4. package/06-04.js +7 -0
  5. package/AnswersLW5.pdf +0 -0
  6. package/m0603/m0603.js +30 -0
  7. package/m0603/node_modules/.package-lock.json +16 -0
  8. package/m0603/node_modules/nodemailer/.gitattributes +6 -0
  9. package/m0603/node_modules/nodemailer/.prettierrc.js +8 -0
  10. package/m0603/node_modules/nodemailer/CHANGELOG.md +725 -0
  11. package/m0603/node_modules/nodemailer/CODE_OF_CONDUCT.md +76 -0
  12. package/m0603/node_modules/nodemailer/CONTRIBUTING.md +67 -0
  13. package/m0603/node_modules/nodemailer/LICENSE +16 -0
  14. package/m0603/node_modules/nodemailer/README.md +97 -0
  15. package/m0603/node_modules/nodemailer/SECURITY.txt +22 -0
  16. package/m0603/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  17. package/m0603/node_modules/nodemailer/lib/base64/index.js +142 -0
  18. package/m0603/node_modules/nodemailer/lib/dkim/index.js +251 -0
  19. package/m0603/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  20. package/m0603/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  21. package/m0603/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  22. package/m0603/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  23. package/m0603/node_modules/nodemailer/lib/fetch/index.js +274 -0
  24. package/m0603/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  25. package/m0603/node_modules/nodemailer/lib/mail-composer/index.js +558 -0
  26. package/m0603/node_modules/nodemailer/lib/mailer/index.js +427 -0
  27. package/m0603/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  28. package/m0603/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
  29. package/m0603/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  30. package/m0603/node_modules/nodemailer/lib/mime-node/index.js +1290 -0
  31. package/m0603/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  32. package/m0603/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  33. package/m0603/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  34. package/m0603/node_modules/nodemailer/lib/nodemailer.js +143 -0
  35. package/m0603/node_modules/nodemailer/lib/qp/index.js +219 -0
  36. package/m0603/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  37. package/m0603/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
  38. package/m0603/node_modules/nodemailer/lib/shared/index.js +638 -0
  39. package/m0603/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  40. package/m0603/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  41. package/m0603/node_modules/nodemailer/lib/smtp-connection/index.js +1796 -0
  42. package/m0603/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
  43. package/m0603/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
  44. package/m0603/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
  45. package/m0603/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  46. package/m0603/node_modules/nodemailer/lib/well-known/index.js +47 -0
  47. package/m0603/node_modules/nodemailer/lib/well-known/services.json +286 -0
  48. package/m0603/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
  49. package/m0603/node_modules/nodemailer/package.json +46 -0
  50. package/m0603/node_modules/nodemailer/postinstall.js +101 -0
  51. package/m0603/package-lock.json +31 -0
  52. package/m0603/package.json +15 -0
  53. package/package.json +16 -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,286 @@
1
+ {
2
+ "1und1": {
3
+ "host": "smtp.1und1.de",
4
+ "port": 465,
5
+ "secure": true,
6
+ "authMethod": "LOGIN"
7
+ },
8
+
9
+ "AOL": {
10
+ "domains": ["aol.com"],
11
+ "host": "smtp.aol.com",
12
+ "port": 587
13
+ },
14
+
15
+ "Bluewin": {
16
+ "host": "smtpauths.bluewin.ch",
17
+ "domains": ["bluewin.ch"],
18
+ "port": 465
19
+ },
20
+
21
+ "DebugMail": {
22
+ "host": "debugmail.io",
23
+ "port": 25
24
+ },
25
+
26
+ "DynectEmail": {
27
+ "aliases": ["Dynect"],
28
+ "host": "smtp.dynect.net",
29
+ "port": 25
30
+ },
31
+
32
+ "Ethereal": {
33
+ "aliases": ["ethereal.email"],
34
+ "host": "smtp.ethereal.email",
35
+ "port": 587
36
+ },
37
+
38
+ "FastMail": {
39
+ "domains": ["fastmail.fm"],
40
+ "host": "smtp.fastmail.com",
41
+ "port": 465,
42
+ "secure": true
43
+ },
44
+
45
+ "GandiMail": {
46
+ "aliases": ["Gandi", "Gandi Mail"],
47
+ "host": "mail.gandi.net",
48
+ "port": 587
49
+ },
50
+
51
+ "Gmail": {
52
+ "aliases": ["Google Mail"],
53
+ "domains": ["gmail.com", "googlemail.com"],
54
+ "host": "smtp.gmail.com",
55
+ "port": 465,
56
+ "secure": true
57
+ },
58
+
59
+ "Godaddy": {
60
+ "host": "smtpout.secureserver.net",
61
+ "port": 25
62
+ },
63
+
64
+ "GodaddyAsia": {
65
+ "host": "smtp.asia.secureserver.net",
66
+ "port": 25
67
+ },
68
+
69
+ "GodaddyEurope": {
70
+ "host": "smtp.europe.secureserver.net",
71
+ "port": 25
72
+ },
73
+
74
+ "hot.ee": {
75
+ "host": "mail.hot.ee"
76
+ },
77
+
78
+ "Hotmail": {
79
+ "aliases": ["Outlook", "Outlook.com", "Hotmail.com"],
80
+ "domains": ["hotmail.com", "outlook.com"],
81
+ "host": "smtp-mail.outlook.com",
82
+ "port": 587
83
+ },
84
+
85
+ "iCloud": {
86
+ "aliases": ["Me", "Mac"],
87
+ "domains": ["me.com", "mac.com"],
88
+ "host": "smtp.mail.me.com",
89
+ "port": 587
90
+ },
91
+
92
+ "Infomaniak": {
93
+ "host": "mail.infomaniak.com",
94
+ "domains": ["ik.me", "ikmail.com", "etik.com"],
95
+ "port": 587
96
+ },
97
+
98
+ "mail.ee": {
99
+ "host": "smtp.mail.ee"
100
+ },
101
+
102
+ "Mail.ru": {
103
+ "host": "smtp.mail.ru",
104
+ "port": 465,
105
+ "secure": true
106
+ },
107
+
108
+ "Maildev": {
109
+ "port": 1025,
110
+ "ignoreTLS": true
111
+ },
112
+
113
+ "Mailgun": {
114
+ "host": "smtp.mailgun.org",
115
+ "port": 465,
116
+ "secure": true
117
+ },
118
+
119
+ "Mailjet": {
120
+ "host": "in.mailjet.com",
121
+ "port": 587
122
+ },
123
+
124
+ "Mailosaur": {
125
+ "host": "mailosaur.io",
126
+ "port": 25
127
+ },
128
+
129
+ "Mailtrap": {
130
+ "host": "smtp.mailtrap.io",
131
+ "port": 2525
132
+ },
133
+
134
+ "Mandrill": {
135
+ "host": "smtp.mandrillapp.com",
136
+ "port": 587
137
+ },
138
+
139
+ "Naver": {
140
+ "host": "smtp.naver.com",
141
+ "port": 587
142
+ },
143
+
144
+ "One": {
145
+ "host": "send.one.com",
146
+ "port": 465,
147
+ "secure": true
148
+ },
149
+
150
+ "OpenMailBox": {
151
+ "aliases": ["OMB", "openmailbox.org"],
152
+ "host": "smtp.openmailbox.org",
153
+ "port": 465,
154
+ "secure": true
155
+ },
156
+
157
+ "Outlook365": {
158
+ "host": "smtp.office365.com",
159
+ "port": 587,
160
+ "secure": false
161
+ },
162
+
163
+ "OhMySMTP": {
164
+ "host": "smtp.ohmysmtp.com",
165
+ "port": 587,
166
+ "secure": false
167
+ },
168
+
169
+ "Postmark": {
170
+ "aliases": ["PostmarkApp"],
171
+ "host": "smtp.postmarkapp.com",
172
+ "port": 2525
173
+ },
174
+
175
+ "qiye.aliyun": {
176
+ "host": "smtp.mxhichina.com",
177
+ "port": "465",
178
+ "secure": true
179
+ },
180
+
181
+ "QQ": {
182
+ "domains": ["qq.com"],
183
+ "host": "smtp.qq.com",
184
+ "port": 465,
185
+ "secure": true
186
+ },
187
+
188
+ "QQex": {
189
+ "aliases": ["QQ Enterprise"],
190
+ "domains": ["exmail.qq.com"],
191
+ "host": "smtp.exmail.qq.com",
192
+ "port": 465,
193
+ "secure": true
194
+ },
195
+
196
+ "SendCloud": {
197
+ "host": "smtp.sendcloud.net",
198
+ "port": 2525
199
+ },
200
+
201
+ "SendGrid": {
202
+ "host": "smtp.sendgrid.net",
203
+ "port": 587
204
+ },
205
+
206
+ "SendinBlue": {
207
+ "host": "smtp-relay.sendinblue.com",
208
+ "port": 587
209
+ },
210
+
211
+ "SendPulse": {
212
+ "host": "smtp-pulse.com",
213
+ "port": 465,
214
+ "secure": true
215
+ },
216
+
217
+ "SES": {
218
+ "host": "email-smtp.us-east-1.amazonaws.com",
219
+ "port": 465,
220
+ "secure": true
221
+ },
222
+
223
+ "SES-US-EAST-1": {
224
+ "host": "email-smtp.us-east-1.amazonaws.com",
225
+ "port": 465,
226
+ "secure": true
227
+ },
228
+
229
+ "SES-US-WEST-2": {
230
+ "host": "email-smtp.us-west-2.amazonaws.com",
231
+ "port": 465,
232
+ "secure": true
233
+ },
234
+
235
+ "SES-EU-WEST-1": {
236
+ "host": "email-smtp.eu-west-1.amazonaws.com",
237
+ "port": 465,
238
+ "secure": true
239
+ },
240
+
241
+ "Sparkpost": {
242
+ "aliases": ["SparkPost", "SparkPost Mail"],
243
+ "domains": ["sparkpost.com"],
244
+ "host": "smtp.sparkpostmail.com",
245
+ "port": 587,
246
+ "secure": false
247
+ },
248
+
249
+ "Tipimail": {
250
+ "host": "smtp.tipimail.com",
251
+ "port": 587
252
+ },
253
+
254
+ "Yahoo": {
255
+ "domains": ["yahoo.com"],
256
+ "host": "smtp.mail.yahoo.com",
257
+ "port": 465,
258
+ "secure": true
259
+ },
260
+
261
+ "Yandex": {
262
+ "domains": ["yandex.ru"],
263
+ "host": "smtp.yandex.ru",
264
+ "port": 465,
265
+ "secure": true
266
+ },
267
+
268
+ "Zoho": {
269
+ "host": "smtp.zoho.com",
270
+ "port": 465,
271
+ "secure": true,
272
+ "authMethod": "LOGIN"
273
+ },
274
+
275
+ "126": {
276
+ "host": "smtp.126.com",
277
+ "port": 465,
278
+ "secure": true
279
+ },
280
+
281
+ "163": {
282
+ "host": "smtp.163.com",
283
+ "port": 465,
284
+ "secure": true
285
+ }
286
+ }