m06_task3.js 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. package/.idea/.name +1 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +10 -0
  3. package/.idea/jsLibraryMappings.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/node_lab_6.iml +12 -0
  6. package/06_task2.html +73 -0
  7. package/06_task2.js +52 -0
  8. package/06_task3.js +3 -0
  9. package/06_task4.js +3 -0
  10. package/m06_task3.js +28 -0
  11. package/package/index.js +28 -0
  12. package/package/node_modules/.package-lock.json +31 -0
  13. package/package/node_modules/@types/node/LICENSE +21 -0
  14. package/package/node_modules/@types/node/README.md +16 -0
  15. package/package/node_modules/@types/node/assert/strict.d.ts +8 -0
  16. package/package/node_modules/@types/node/assert.d.ts +961 -0
  17. package/package/node_modules/@types/node/async_hooks.d.ts +501 -0
  18. package/package/node_modules/@types/node/buffer.d.ts +2258 -0
  19. package/package/node_modules/@types/node/child_process.d.ts +1369 -0
  20. package/package/node_modules/@types/node/cluster.d.ts +410 -0
  21. package/package/node_modules/@types/node/console.d.ts +412 -0
  22. package/package/node_modules/@types/node/constants.d.ts +18 -0
  23. package/package/node_modules/@types/node/crypto.d.ts +3964 -0
  24. package/package/node_modules/@types/node/dgram.d.ts +545 -0
  25. package/package/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
  26. package/package/node_modules/@types/node/dns/promises.d.ts +370 -0
  27. package/package/node_modules/@types/node/dns.d.ts +659 -0
  28. package/package/node_modules/@types/node/dom-events.d.ts +126 -0
  29. package/package/node_modules/@types/node/domain.d.ts +170 -0
  30. package/package/node_modules/@types/node/events.d.ts +678 -0
  31. package/package/node_modules/@types/node/fs/promises.d.ts +1138 -0
  32. package/package/node_modules/@types/node/fs.d.ts +3872 -0
  33. package/package/node_modules/@types/node/globals.d.ts +300 -0
  34. package/package/node_modules/@types/node/globals.global.d.ts +1 -0
  35. package/package/node_modules/@types/node/http.d.ts +1614 -0
  36. package/package/node_modules/@types/node/http2.d.ts +2134 -0
  37. package/package/node_modules/@types/node/https.d.ts +541 -0
  38. package/package/node_modules/@types/node/index.d.ts +133 -0
  39. package/package/node_modules/@types/node/inspector.d.ts +2741 -0
  40. package/package/node_modules/@types/node/module.d.ts +114 -0
  41. package/package/node_modules/@types/node/net.d.ts +869 -0
  42. package/package/node_modules/@types/node/os.d.ts +466 -0
  43. package/package/node_modules/@types/node/package.json +232 -0
  44. package/package/node_modules/@types/node/path.d.ts +191 -0
  45. package/package/node_modules/@types/node/perf_hooks.d.ts +625 -0
  46. package/package/node_modules/@types/node/process.d.ts +1482 -0
  47. package/package/node_modules/@types/node/punycode.d.ts +117 -0
  48. package/package/node_modules/@types/node/querystring.d.ts +131 -0
  49. package/package/node_modules/@types/node/readline/promises.d.ts +143 -0
  50. package/package/node_modules/@types/node/readline.d.ts +653 -0
  51. package/package/node_modules/@types/node/repl.d.ts +424 -0
  52. package/package/node_modules/@types/node/stream/consumers.d.ts +12 -0
  53. package/package/node_modules/@types/node/stream/promises.d.ts +42 -0
  54. package/package/node_modules/@types/node/stream/web.d.ts +330 -0
  55. package/package/node_modules/@types/node/stream.d.ts +1340 -0
  56. package/package/node_modules/@types/node/string_decoder.d.ts +67 -0
  57. package/package/node_modules/@types/node/test.d.ts +314 -0
  58. package/package/node_modules/@types/node/timers/promises.d.ts +68 -0
  59. package/package/node_modules/@types/node/timers.d.ts +94 -0
  60. package/package/node_modules/@types/node/tls.d.ts +1028 -0
  61. package/package/node_modules/@types/node/trace_events.d.ts +171 -0
  62. package/package/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  63. package/package/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
  64. package/package/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
  65. package/package/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
  66. package/package/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
  67. package/package/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
  68. package/package/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  69. package/package/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  70. package/package/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
  71. package/package/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  72. package/package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
  73. package/package/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
  74. package/package/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
  75. package/package/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  76. package/package/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  77. package/package/node_modules/@types/node/ts4.8/events.d.ts +678 -0
  78. package/package/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
  79. package/package/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
  80. package/package/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
  81. package/package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  82. package/package/node_modules/@types/node/ts4.8/http.d.ts +1614 -0
  83. package/package/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
  84. package/package/node_modules/@types/node/ts4.8/https.d.ts +541 -0
  85. package/package/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  86. package/package/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
  87. package/package/node_modules/@types/node/ts4.8/module.d.ts +114 -0
  88. package/package/node_modules/@types/node/ts4.8/net.d.ts +869 -0
  89. package/package/node_modules/@types/node/ts4.8/os.d.ts +466 -0
  90. package/package/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  91. package/package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
  92. package/package/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
  93. package/package/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  94. package/package/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  95. package/package/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
  96. package/package/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
  97. package/package/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  98. package/package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  99. package/package/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  100. package/package/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  101. package/package/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
  102. package/package/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  103. package/package/node_modules/@types/node/ts4.8/test.d.ts +314 -0
  104. package/package/node_modules/@types/node/ts4.8/timers/promises.d.ts +68 -0
  105. package/package/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
  106. package/package/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
  107. package/package/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
  108. package/package/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
  109. package/package/node_modules/@types/node/ts4.8/url.d.ts +897 -0
  110. package/package/node_modules/@types/node/ts4.8/util.d.ts +1850 -0
  111. package/package/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
  112. package/package/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
  113. package/package/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
  114. package/package/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
  115. package/package/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  116. package/package/node_modules/@types/node/tty.d.ts +206 -0
  117. package/package/node_modules/@types/node/url.d.ts +897 -0
  118. package/package/node_modules/@types/node/util.d.ts +1850 -0
  119. package/package/node_modules/@types/node/v8.d.ts +396 -0
  120. package/package/node_modules/@types/node/vm.d.ts +509 -0
  121. package/package/node_modules/@types/node/wasi.d.ts +158 -0
  122. package/package/node_modules/@types/node/worker_threads.d.ts +689 -0
  123. package/package/node_modules/@types/node/zlib.d.ts +517 -0
  124. package/package/node_modules/@types/nodemailer/LICENSE +21 -0
  125. package/package/node_modules/@types/nodemailer/README.md +16 -0
  126. package/package/node_modules/@types/nodemailer/index.d.ts +83 -0
  127. package/package/node_modules/@types/nodemailer/lib/addressparser/index.d.ts +31 -0
  128. package/package/node_modules/@types/nodemailer/lib/base64/index.d.ts +22 -0
  129. package/package/node_modules/@types/nodemailer/lib/dkim/index.d.ts +45 -0
  130. package/package/node_modules/@types/nodemailer/lib/dkim/message-parser.d.ts +75 -0
  131. package/package/node_modules/@types/nodemailer/lib/dkim/relaxed-body.d.ts +75 -0
  132. package/package/node_modules/@types/nodemailer/lib/dkim/sign.d.ts +11 -0
  133. package/package/node_modules/@types/nodemailer/lib/fetch/cookies.d.ts +54 -0
  134. package/package/node_modules/@types/nodemailer/lib/fetch/index.d.ts +38 -0
  135. package/package/node_modules/@types/nodemailer/lib/json-transport/index.d.ts +50 -0
  136. package/package/node_modules/@types/nodemailer/lib/mail-composer/index.d.ts +25 -0
  137. package/package/node_modules/@types/nodemailer/lib/mailer/index.d.ts +230 -0
  138. package/package/node_modules/@types/nodemailer/lib/mailer/mail-message.d.ts +28 -0
  139. package/package/node_modules/@types/nodemailer/lib/mime-funcs/index.d.ts +87 -0
  140. package/package/node_modules/@types/nodemailer/lib/mime-funcs/mime-types.d.ts +2 -0
  141. package/package/node_modules/@types/nodemailer/lib/mime-node/index.d.ts +137 -0
  142. package/package/node_modules/@types/nodemailer/lib/mime-node/last-newline.d.ts +9 -0
  143. package/package/node_modules/@types/nodemailer/lib/qp/index.d.ts +23 -0
  144. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/index.d.ts +53 -0
  145. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-unix.d.ts +7 -0
  146. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-windows.d.ts +7 -0
  147. package/package/node_modules/@types/nodemailer/lib/ses-transport/index.d.ts +136 -0
  148. package/package/node_modules/@types/nodemailer/lib/shared/index.d.ts +51 -0
  149. package/package/node_modules/@types/nodemailer/lib/smtp-connection/data-stream.d.ts +11 -0
  150. package/package/node_modules/@types/nodemailer/lib/smtp-connection/http-proxy-client.d.ts +11 -0
  151. package/package/node_modules/@types/nodemailer/lib/smtp-connection/index.d.ts +254 -0
  152. package/package/node_modules/@types/nodemailer/lib/smtp-pool/index.d.ts +90 -0
  153. package/package/node_modules/@types/nodemailer/lib/smtp-pool/pool-resource.d.ts +66 -0
  154. package/package/node_modules/@types/nodemailer/lib/smtp-transport/index.d.ts +115 -0
  155. package/package/node_modules/@types/nodemailer/lib/stream-transport/index.d.ts +56 -0
  156. package/package/node_modules/@types/nodemailer/lib/well-known/index.d.ts +6 -0
  157. package/package/node_modules/@types/nodemailer/lib/xoauth2/index.d.ts +110 -0
  158. package/package/node_modules/@types/nodemailer/package.json +37 -0
  159. package/package/node_modules/nodemailer/.gitattributes +6 -0
  160. package/package/node_modules/nodemailer/.prettierrc.js +8 -0
  161. package/package/node_modules/nodemailer/CHANGELOG.md +715 -0
  162. package/package/node_modules/nodemailer/CODE_OF_CONDUCT.md +76 -0
  163. package/package/node_modules/nodemailer/CONTRIBUTING.md +67 -0
  164. package/package/node_modules/nodemailer/LICENSE +16 -0
  165. package/package/node_modules/nodemailer/README.md +93 -0
  166. package/package/node_modules/nodemailer/SECURITY.txt +22 -0
  167. package/package/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  168. package/package/node_modules/nodemailer/lib/base64/index.js +142 -0
  169. package/package/node_modules/nodemailer/lib/dkim/index.js +251 -0
  170. package/package/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  171. package/package/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  172. package/package/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  173. package/package/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  174. package/package/node_modules/nodemailer/lib/fetch/index.js +269 -0
  175. package/package/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  176. package/package/node_modules/nodemailer/lib/mail-composer/index.js +558 -0
  177. package/package/node_modules/nodemailer/lib/mailer/index.js +427 -0
  178. package/package/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  179. package/package/node_modules/nodemailer/lib/mime-funcs/index.js +619 -0
  180. package/package/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  181. package/package/node_modules/nodemailer/lib/mime-node/index.js +1290 -0
  182. package/package/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  183. package/package/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  184. package/package/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  185. package/package/node_modules/nodemailer/lib/nodemailer.js +143 -0
  186. package/package/node_modules/nodemailer/lib/qp/index.js +219 -0
  187. package/package/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  188. package/package/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
  189. package/package/node_modules/nodemailer/lib/shared/index.js +639 -0
  190. package/package/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  191. package/package/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  192. package/package/node_modules/nodemailer/lib/smtp-connection/index.js +1786 -0
  193. package/package/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
  194. package/package/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
  195. package/package/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
  196. package/package/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  197. package/package/node_modules/nodemailer/lib/well-known/index.js +47 -0
  198. package/package/node_modules/nodemailer/lib/well-known/services.json +286 -0
  199. package/package/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
  200. package/package/node_modules/nodemailer/package.json +46 -0
  201. package/package/node_modules/nodemailer/postinstall.js +101 -0
  202. package/package/package-lock.json +60 -0
  203. package/package/package.json +6 -0
  204. package/package.json +19 -0
@@ -0,0 +1,87 @@
1
+ export interface HeaderValue {
2
+ value: string;
3
+ params?: { [key: string]: string } | undefined;
4
+ }
5
+
6
+ export interface ParsedHeaderValue extends HeaderValue {
7
+ params: { [key: string]: string };
8
+ }
9
+
10
+ export interface ParsedHeaderParam {
11
+ key: string;
12
+ value: string;
13
+ }
14
+
15
+ /** Checks if a value is plaintext string (uses only printable 7bit chars) */
16
+ export function isPlainText(value: string): boolean;
17
+
18
+ /**
19
+ * Checks if a multi line string containes lines longer than the selected value.
20
+ *
21
+ * Useful when detecting if a mail message needs any processing at all –
22
+ * if only plaintext characters are used and lines are short, then there is
23
+ * no need to encode the values in any way. If the value is plaintext but has
24
+ * longer lines then allowed, then use format=flowed
25
+ */
26
+ export function hasLongerLines(str: string, lineLength: number): boolean;
27
+
28
+ /** Encodes a string or an Buffer to an UTF-8 MIME Word (rfc2047) */
29
+ export function encodeWord(data: Buffer | string, mimeWordEncoding?: 'Q' | 'B', maxLength?: number): string;
30
+
31
+ /** Finds word sequences with non ascii text and converts these to mime words */
32
+ export function encodeWords(value: string, mimeWordEncoding?: 'Q' | 'B', maxLength?: number): string;
33
+
34
+ /**
35
+ * Joins parsed header value together as 'value; param1=value1; param2=value2'
36
+ * PS: We are following RFC 822 for the list of special characters that we need to keep in quotes.
37
+ * Refer: https://www.w3.org/Protocols/rfc1341/4_Content-Type.html
38
+ */
39
+ export function buildHeaderValue(structured: HeaderValue): string;
40
+
41
+ /**
42
+ * Encodes a string or an Buffer to an UTF-8 Parameter Value Continuation encoding (rfc2231)
43
+ * Useful for splitting long parameter values.
44
+ *
45
+ * For example
46
+ * ```
47
+ * title="unicode string"
48
+ * ```
49
+ * becomes
50
+ * ```
51
+ * title*0*=utf-8''unicode
52
+ * title*1*=%20string
53
+ * ```
54
+ */
55
+ export function buildHeaderParam(key: string, data: Buffer | string, maxLength?: number): ParsedHeaderParam[];
56
+
57
+ /**
58
+ * Parses a header value with key=value arguments into a structured
59
+ * object.
60
+ *
61
+ * ```
62
+ * parseHeaderValue('content-type: text/plain; CHARSET='UTF-8') ->
63
+ * {
64
+ * 'value': 'text/plain',
65
+ * 'params': {
66
+ * 'charset': 'UTF-8'
67
+ * }
68
+ * }
69
+ * ```
70
+ */
71
+ export function parseHeaderValue(str: string): ParsedHeaderValue;
72
+
73
+ /** Returns file extension for a content type string. If no suitable extensions are found, 'bin' is used as the default extension */
74
+ export function detectExtension(mimeType: string): string;
75
+
76
+ /** Returns content type for a file extension. If no suitable content types are found, 'application/octet-stream' is used as the default content type */
77
+ export function detectMimeType(extension: string): string;
78
+
79
+ /** Folds long lines, useful for folding header lines (afterSpace=false) and flowed text (afterSpace=true) */
80
+ export function foldLines(str: string, lineLength?: number, afterSpace?: boolean): string;
81
+
82
+ /** Splits a mime encoded string. Needed for dividing mime words into smaller chunks */
83
+ export function splitMimeEncodedString(str: string, maxlen?: number): string[];
84
+
85
+ export function encodeURICharComponent(chr: string): string;
86
+
87
+ export function safeEncodeURIComponent(str: string): string;
@@ -0,0 +1,2 @@
1
+ export function detectMimeType(filename: string | false): string;
2
+ export function detectExtension(mimeType: string | false): string;
@@ -0,0 +1,137 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Readable, ReadableOptions, Transform } from 'stream';
4
+
5
+ import Mail = require('../mailer');
6
+ import SMTPConnection = require('../smtp-connection');
7
+
8
+ declare namespace MimeNode {
9
+ interface Addresses {
10
+ from?: string[] | undefined;
11
+ sender?: string[] | undefined;
12
+ 'reply-to'?: string[] | undefined;
13
+ to?: string[] | undefined;
14
+ cc?: string[] | undefined;
15
+ bcc?: string[] | undefined;
16
+ }
17
+
18
+ interface Envelope {
19
+ /** includes an address object or is set to false */
20
+ from: string | false;
21
+ /** includes an array of address objects */
22
+ to: string[];
23
+ }
24
+
25
+ interface Options {
26
+ /** root node for this tree */
27
+ rootNode?: MimeNode | undefined;
28
+ /** immediate parent for this node */
29
+ parentNode?: MimeNode | undefined;
30
+ /** filename for an attachment node */
31
+ filename?: string | undefined;
32
+ /** shared part of the unique multipart boundary */
33
+ baseBoundary?: string | undefined;
34
+ /** If true, do not exclude Bcc from the generated headers */
35
+ keepBcc?: boolean | undefined;
36
+ /** either 'Q' (the default) or 'B' */
37
+ textEncoding?: 'B' | 'Q' | undefined;
38
+ /** method to normalize header keys for custom caseing */
39
+ normalizeHeaderKey?(key: string): string;
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Creates a new mime tree node. Assumes 'multipart/*' as the content type
45
+ * if it is a branch, anything else counts as leaf. If rootNode is missing from
46
+ * the options, assumes this is the root.
47
+ */
48
+ declare class MimeNode {
49
+ constructor(contentType?: string, options?: MimeNode.Options);
50
+
51
+ /** Creates and appends a child node.Arguments provided are passed to MimeNode constructor */
52
+ createChild(contentType: string, options?: MimeNode.Options): MimeNode;
53
+
54
+ /** Appends an existing node to the mime tree. Removes the node from an existing tree if needed */
55
+ appendChild(childNode: MimeNode): MimeNode;
56
+
57
+ /** Replaces current node with another node */
58
+ replace(node: MimeNode): MimeNode;
59
+
60
+ /** Removes current node from the mime tree */
61
+ remove(): this;
62
+
63
+ /**
64
+ * Sets a header value. If the value for selected key exists, it is overwritten.
65
+ * You can set multiple values as well by using [{key:'', value:''}] or
66
+ * {key: 'value'} as the first argument.
67
+ */
68
+ setHeader(key: string, value: string | string[]): this;
69
+ setHeader(headers: { [key: string]: string } | Array<{ key: string, value: string }>): this;
70
+
71
+ /**
72
+ * Adds a header value. If the value for selected key exists, the value is appended
73
+ * as a new field and old one is not touched.
74
+ * You can set multiple values as well by using [{key:'', value:''}] or
75
+ * {key: 'value'} as the first argument.
76
+ */
77
+ addHeader(key: string, value: string): this;
78
+ addHeader(headers: { [key: string]: string } | Array<{ key: string, value: string }>): this;
79
+
80
+ /** Retrieves the first mathcing value of a selected key */
81
+ getHeader(key: string): string;
82
+
83
+ /**
84
+ * Sets body content for current node. If the value is a string, charset is added automatically
85
+ * to Content-Type (if it is text/*). If the value is a Buffer, you need to specify
86
+ * the charset yourself
87
+ */
88
+ setContent(content: string | Buffer | Readable): this;
89
+
90
+ /** Generate the message and return it with a callback or promise */
91
+ build(callback: (err: Error | null, buf: Buffer) => void): void;
92
+ build(): Promise<Buffer>;
93
+
94
+ getTransferEncoding(): string;
95
+
96
+ /** Builds the header block for the mime node. Append \r\n\r\n before writing the content */
97
+ buildHeaders(): string;
98
+
99
+ /**
100
+ * Streams the rfc2822 message from the current node. If this is a root node,
101
+ * mandatory header fields are set if missing (Date, Message-Id, MIME-Version)
102
+ */
103
+ createReadStream(options?: ReadableOptions): Readable;
104
+
105
+ /**
106
+ * Appends a transform stream object to the transforms list. Final output
107
+ * is passed through this stream before exposing
108
+ */
109
+ transform(transform: Transform): void;
110
+
111
+ /**
112
+ * Appends a post process function. The functon is run after transforms and
113
+ * uses the following syntax
114
+ *
115
+ * processFunc(input) -> outputStream
116
+ */
117
+ processFunc(processFunc: (outputStream: Readable) => Readable): void;
118
+
119
+ stream(outputStream: Readable, options: ReadableOptions, done: (err?: Error | null) => void): void;
120
+
121
+ /** Sets envelope to be used instead of the generated one */
122
+ setEnvelope(envelope: Mail.Envelope): this;
123
+
124
+ /** Generates and returns an object with parsed address fields */
125
+ getAddresses(): MimeNode.Addresses;
126
+
127
+ /** Generates and returns SMTP envelope with the sender address and a list of recipients addresses */
128
+ getEnvelope(): MimeNode.Envelope;
129
+
130
+ /** Returns Message-Id value. If it does not exist, then creates one */
131
+ messageId(): string;
132
+
133
+ /** Sets pregenerated content that will be used as the output of this node */
134
+ setRaw(raw: string | Buffer | Readable): this;
135
+ }
136
+
137
+ export = MimeNode;
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Transform } from 'stream';
4
+
5
+ declare class LastNewline extends Transform {
6
+ lastByte: boolean;
7
+ }
8
+
9
+ export = LastNewline;
@@ -0,0 +1,23 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Transform, TransformOptions } from 'stream';
4
+
5
+ /** Encodes a Buffer into a Quoted-Printable encoded string */
6
+ export function encode(buffer: Buffer | string): string;
7
+
8
+ /** Adds soft line breaks to a Quoted-Printable string */
9
+ export function wrap(str: string, lineLength?: number): string;
10
+
11
+ export interface EncoderOptions extends TransformOptions {
12
+ lineLength?: number | false | undefined;
13
+ }
14
+
15
+ /** Creates a transform stream for encoding data to Quoted-Printable encoding */
16
+ export class Encoder extends Transform {
17
+ options: EncoderOptions;
18
+
19
+ inputBytes: number;
20
+ outputBytes: number;
21
+
22
+ constructor(options?: EncoderOptions);
23
+ }
@@ -0,0 +1,53 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Transport, TransportOptions } from '../..';
4
+
5
+ import * as shared from '../shared';
6
+
7
+ import Mail = require('../mailer');
8
+ import MailMessage = require('../mailer/mail-message');
9
+ import MimeNode = require('../mime-node');
10
+
11
+ declare namespace SendmailTransport {
12
+ type MailOptions = Mail.Options;
13
+
14
+ interface Options extends MailOptions, TransportOptions {
15
+ sendmail: true;
16
+ /** path to the sendmail command (defaults to ‘sendmail’) */
17
+ path?: string | undefined;
18
+ /** either ‘windows’ or ‘unix’ (default). Forces all newlines in the output to either use Windows syntax <CR><LF> or Unix syntax <LF> */
19
+ newline?: string | undefined;
20
+ /** an optional array of command line options to pass to the sendmail command (ie. ["-f", "foo@blurdybloop.com"]). This overrides all default arguments except for ’-i’ and recipient list so you need to make sure you have all required arguments set (ie. the ‘-f’ flag). */
21
+ args?: string[] | undefined;
22
+ }
23
+
24
+ interface SentMessageInfo {
25
+ envelope: MimeNode.Envelope;
26
+ messageId: string;
27
+ response: string;
28
+ accepted: Array<string | Mail.Address>;
29
+ rejected: Array<string | Mail.Address>;
30
+ pending: Array<string | Mail.Address>;
31
+ }
32
+ }
33
+
34
+ declare class SendmailTransport implements Transport<SendmailTransport.SentMessageInfo> {
35
+ options: SendmailTransport.Options;
36
+ logger: shared.Logger;
37
+ mailer: Mail<SendmailTransport.SentMessageInfo>;
38
+ name: string;
39
+ version: string;
40
+ path: string;
41
+ args: string[] | false;
42
+ winbreak: boolean;
43
+
44
+ constructor(options: SendmailTransport.Options);
45
+
46
+ /** Compiles a mailcomposer message and forwards it to handler that sends it */
47
+ send(
48
+ mail: MailMessage<SendmailTransport.SentMessageInfo>,
49
+ callback: (err: Error | null, info: SendmailTransport.SentMessageInfo) => void,
50
+ ): void;
51
+ }
52
+
53
+ export = SendmailTransport;
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Transform } from 'stream';
4
+
5
+ declare class LeUnix extends Transform {}
6
+
7
+ export = LeUnix;
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Transform } from 'stream';
4
+
5
+ declare class LeWindows extends Transform {}
6
+
7
+ export = LeWindows;
@@ -0,0 +1,136 @@
1
+ /// <reference types="node" />
2
+
3
+ import { EventEmitter } from 'events';
4
+
5
+ import { Transport, TransportOptions } from '../..';
6
+
7
+ import * as shared from '../shared';
8
+
9
+ import Mail = require('../mailer');
10
+ import MailMessage = require('../mailer/mail-message');
11
+ import MimeNode = require('../mime-node');
12
+
13
+ declare namespace SESTransport {
14
+ interface MailOptions extends Mail.Options {
15
+ /** list of keys that SendRawEmail method can take */
16
+ ses?: MailSesOptions | undefined;
17
+ }
18
+
19
+ interface MailSesOptions {
20
+ /**
21
+ * The identity's email address. If you do not provide a value for this parameter, you must specify a "From" address in the raw text of the message. (You can also specify both.) Amazon SES does not support the SMTPUTF8 extension, as described inRFC6531. For this reason, the local part of a source email address (the part of the email address that precedes the @ sign) may only contain 7-bit ASCII characters. If the domain part of an address (the part after the @ sign) contains non-ASCII characters, they must be encoded using Punycode, as described in RFC3492. The sender name (also known as the friendly name) may contain non-ASCII characters. These characters must be encoded using MIME encoded-word syntax, as described in RFC 2047. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. If you specify the Source parameter and have feedback forwarding enabled, then bounces and complaints will be sent to this email address. This takes precedence over any Return-Path header that you might include in the raw text of the message.
22
+ */
23
+ Source?: string | undefined;
24
+ /**
25
+ * A list of destinations for the message, consisting of To:, CC:, and BCC: addresses.
26
+ */
27
+ Destinations?: string[] | undefined;
28
+ /**
29
+ * The raw email message itself. The message has to meet the following criteria: The message has to contain a header and a body, separated by a blank line. All of the required header fields must be present in the message. Each part of a multipart MIME message must be formatted properly. Attachments must be of a content type that Amazon SES supports. For a list on unsupported content types, see Unsupported Attachment Types in the Amazon SES Developer Guide. The entire message must be base64-encoded. If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, we highly recommend that you encode that content. For more information, see Sending Raw Email in the Amazon SES Developer Guide. Per RFC 5321, the maximum length of each line of text, including the &lt;CRLF&gt;, must not exceed 1,000 characters.
30
+ */
31
+ RawMessage?: {
32
+ /**
33
+ * The raw data of the message. This data needs to base64-encoded if you are accessing Amazon SES directly through the HTTPS interface. If you are accessing Amazon SES using an AWS SDK, the SDK takes care of the base 64-encoding for you. In all cases, the client must ensure that the message format complies with Internet email standards regarding email header fields, MIME types, and MIME encoding. The To:, CC:, and BCC: headers in the raw message can contain a group list. If you are using SendRawEmail with sending authorization, you can include X-headers in the raw message to specify the "Source," "From," and "Return-Path" addresses. For more information, see the documentation for SendRawEmail. Do not include these X-headers in the DKIM signature, because they are removed by Amazon SES before sending the email. For more information, go to the Amazon SES Developer Guide.
34
+ */
35
+ Data: Buffer|Uint8Array|{}|string;
36
+ } | undefined;
37
+ /**
38
+ * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to specify a particular "From" address in the header of the raw email. Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw message of the email. If you use both the FromArn parameter and the corresponding X-header, Amazon SES uses the value of the FromArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
39
+ */
40
+ FromArn?: string | undefined;
41
+ /**
42
+ * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter. For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to send from user@example.com, then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the Source to be user@example.com. Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw message of the email. If you use both the SourceArn parameter and the corresponding X-header, Amazon SES uses the value of the SourceArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
43
+ */
44
+ SourceArn?: string | undefined;
45
+ /**
46
+ * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter. For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use feedback@example.com, then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the ReturnPath to be feedback@example.com. Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the raw message of the email. If you use both the ReturnPathArn parameter and the corresponding X-header, Amazon SES uses the value of the ReturnPathArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
47
+ */
48
+ ReturnPathArn?: string | undefined;
49
+ /**
50
+ * A list of tags, in the form of name/value pairs, to apply to an email that you send using SendRawEmail. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.
51
+ */
52
+ Tags?: Array<{
53
+ /**
54
+ * The name of the tag. The name must: This value can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). Contain less than 256 characters.
55
+ */
56
+ Name: string;
57
+ /**
58
+ * The value of the tag. The value must: This value can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). Contain less than 256 characters.
59
+ */
60
+ Value: string;
61
+ }> | undefined;
62
+ /**
63
+ * The name of the configuration set to use when you send an email using SendRawEmail.
64
+ */
65
+ ConfigurationSetName?: string | undefined;
66
+ }
67
+
68
+ interface Options extends MailOptions, TransportOptions {
69
+ /** is an option that expects an instantiated aws.SES object */
70
+ SES: any; // aws-sdk.SES object
71
+ /** How many messages per second is allowed to be delivered to SES */
72
+ maxConnections?: number | undefined;
73
+ /** How many parallel connections to allow towards SES */
74
+ sendingRate?: number | undefined;
75
+ }
76
+
77
+ interface SentMessageInfo {
78
+ /** an envelope object {from:‘address’, to:[‘address’]} */
79
+ envelope: MimeNode.Envelope;
80
+ /** the Message-ID header value. This value is derived from the response of SES API, so it differs from the Message-ID values used in logging. */
81
+ messageId: string;
82
+ response: string;
83
+ accepted: Array<string | Mail.Address>;
84
+ rejected: Array<string | Mail.Address>;
85
+ pending: Array<string | Mail.Address>;
86
+ }
87
+ }
88
+
89
+ declare class SESTransport extends EventEmitter implements Transport<SESTransport.SentMessageInfo> {
90
+ options: SESTransport.Options;
91
+
92
+ logger: shared.Logger;
93
+ mailer: Mail<SESTransport.SentMessageInfo>;
94
+
95
+ name: string;
96
+ version: string;
97
+
98
+ ses: any;
99
+
100
+ maxConnections: number;
101
+ connections: number;
102
+ sendingRate: number;
103
+ sendingRateTTL: number | null;
104
+ rateInterval: number;
105
+ rateMessages: Array<{ ts: number, pending: boolean }>;
106
+ pending: Array<{ mail: Mail<SESTransport.SentMessageInfo>; callback(err: Error | null, info: SESTransport.SentMessageInfo): void; }>;
107
+ idling: boolean;
108
+
109
+ constructor(options: SESTransport.Options);
110
+
111
+ /** Schedules a sending of a message */
112
+ send(mail: MailMessage<SESTransport.SentMessageInfo>, callback: (err: Error | null, info: SESTransport.SentMessageInfo) => void): void;
113
+
114
+ /** Returns true if there are free slots in the queue */
115
+ isIdle(): boolean;
116
+
117
+ /** Verifies SES configuration */
118
+ verify(callback: (err: Error | null, success: true) => void): void;
119
+ verify(): Promise<true>;
120
+
121
+ addListener(event: 'idle', listener: () => void): this;
122
+
123
+ emit(event: 'idle'): boolean;
124
+
125
+ on(event: 'idle', listener: () => void): this;
126
+
127
+ once(event: 'idle', listener: () => void): this;
128
+
129
+ prependListener(event: 'idle', listener: () => void): this;
130
+
131
+ prependOnceListener(event: 'idle', listener: () => void): this;
132
+
133
+ listeners(event: 'idle'): Array<() => void>;
134
+ }
135
+
136
+ export = SESTransport;
@@ -0,0 +1,51 @@
1
+ /// <reference types="node" />
2
+
3
+ import SMTPConnection = require('../smtp-connection');
4
+
5
+ import * as stream from 'stream';
6
+
7
+ export type LoggerLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
8
+
9
+ export interface Logger {
10
+ level(level: LoggerLevel): void;
11
+ trace(...params: any[]): void;
12
+ debug(...params: any[]): void;
13
+ info(...params: any[]): void;
14
+ warn(...params: any[]): void;
15
+ error(...params: any[]): void;
16
+ fatal(...params: any[]): void;
17
+ }
18
+
19
+ export interface ResolveHostnameOptions {
20
+ host?: string | undefined;
21
+ servername?: string | false | undefined;
22
+ }
23
+
24
+ export interface ResolveHostnameValue {
25
+ host: string;
26
+ servername: string | false;
27
+ _cached?: true | undefined;
28
+ }
29
+
30
+ export function resolveHostname(options: ResolveHostnameOptions | null | undefined, callback: (err: Error | null, value: ResolveHostnameValue) => void): void;
31
+
32
+ /** Parses connection url to a structured configuration object */
33
+ export function parseConnectionUrl(url: string): SMTPConnection.Options;
34
+ /** Returns a bunyan-compatible logger interface. Uses either provided logger or creates a default console logger */
35
+ export function getLogger(options?: { [key: string]: any }, defaults?: { [key: string]: any }): Logger;
36
+ /** Wrapper for creating a callback than either resolves or rejects a promise based on input */
37
+ export function callbackPromise(resolve: (...args: any[]) => void, reject: (err: Error) => void): () => void;
38
+ /**
39
+ * Resolves a String or a Buffer value for content value. Useful if the value
40
+ * is a Stream or a file or an URL. If the value is a Stream, overwrites
41
+ * the stream object with the resolved value (you can't stream a value twice).
42
+ *
43
+ * This is useful when you want to create a plugin that needs a content value,
44
+ * for example the `html` or `text` value as a String or a Buffer but not as
45
+ * a file path or an URL.
46
+ */
47
+ export function resolveContent(data: object | any[], key: string | number, callback: (err: Error | null, value: Buffer | string) => void): void;
48
+ export function resolveContent(data: object | any[], key: string | number): Promise<Buffer | string>;
49
+ /** Copies properties from source objects to target objects */
50
+ export function assign(target: object, ...sources: object[]): object;
51
+ export function encodeXText(str: string): string;
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Transform } from 'stream';
4
+
5
+ /**
6
+ * Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
7
+ * Also makes sure that only <CR><LF> sequences are used for linebreaks
8
+ */
9
+ declare class DataStream extends Transform {}
10
+
11
+ export = DataStream;
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Socket } from 'net';
4
+ import { TLSSocket } from 'tls';
5
+
6
+ /**
7
+ * Establishes proxied connection to destinationPort
8
+ */
9
+ declare function httpProxyClient(proxyUrl: string, destinationPort: number, destinationHost: string, callback: (err: Error | null, socket: TLSSocket | Socket) => void): void;
10
+
11
+ export = httpProxyClient;