@bobfrankston/mailx 1.0.12 → 1.0.13

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 (237) hide show
  1. package/bin/mailx.js +47 -29
  2. package/client/app.js +93 -13
  3. package/client/components/folder-tree.js +84 -3
  4. package/client/components/message-list.js +134 -8
  5. package/client/components/message-viewer.js +130 -13
  6. package/client/compose/compose.html +4 -4
  7. package/client/compose/compose.js +53 -34
  8. package/client/index.html +33 -9
  9. package/client/lib/api-client.js +102 -30
  10. package/client/lib/mailxapi.js +123 -0
  11. package/client/package.json +1 -1
  12. package/client/styles/components.css +188 -15
  13. package/client/styles/layout.css +2 -1
  14. package/killmail.cmd +6 -0
  15. package/launch.ps1 +47 -5
  16. package/launcher/bin/mailx-app.exe +0 -0
  17. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Breadcrumbs +0 -0
  18. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Crashpad/metadata +0 -0
  19. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Crashpad/settings.dat +0 -0
  20. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Crashpad/throttle_store.dat +1 -0
  21. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/CrashpadMetrics-active.pma +0 -0
  22. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/BrowsingTopicsSiteData +0 -0
  23. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Cache/No_Vary_Search/journal.baj +1 -0
  24. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/DIPS +0 -0
  25. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/DashTrackerDatabase +0 -0
  26. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/EdgeJourneys/EdgeJourneys.db +0 -0
  27. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Rules/LOCK +0 -0
  28. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Rules/LOG +3 -0
  29. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Rules/MANIFEST-000001 +0 -0
  30. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Scripts/LOCK +0 -0
  31. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Scripts/LOG +3 -0
  32. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension Scripts/MANIFEST-000001 +0 -0
  33. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension State/LOCK +0 -0
  34. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension State/LOG +3 -0
  35. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Extension State/MANIFEST-000001 +0 -0
  36. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/ExtensionActivityComp +0 -0
  37. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/ExtensionActivityEdge +0 -0
  38. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Favicons +0 -0
  39. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/History +0 -0
  40. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/History-journal +0 -0
  41. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/IndexedDB/devtools_devtools_0.indexeddb.leveldb/LOCK +0 -0
  42. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/IndexedDB/devtools_devtools_0.indexeddb.leveldb/LOG +3 -0
  43. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/IndexedDB/devtools_devtools_0.indexeddb.leveldb/MANIFEST-000001 +0 -0
  44. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOCK +0 -0
  45. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOG +3 -0
  46. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Local Storage/leveldb/MANIFEST-000001 +0 -0
  47. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Login Data +0 -0
  48. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Login Data For Account +0 -0
  49. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Network/Cookies +0 -0
  50. NEL +0 -0
  51. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Network/Trust Tokens +0 -0
  52. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Network Action Predictor +0 -0
  53. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Preferences +1 -0
  54. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Safe Browsing Network/Safe Browsing Cookies +0 -0
  55. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/ServerCertificate +0 -0
  56. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Session Storage/LOCK +0 -0
  57. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Session Storage/LOG +3 -0
  58. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Session Storage/MANIFEST-000001 +0 -0
  59. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Shared Dictionary/db +0 -0
  60. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/SharedStorage +0 -0
  61. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Shortcuts +0 -0
  62. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOCK +0 -0
  63. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOG +3 -0
  64. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Site Characteristics Database/MANIFEST-000001 +0 -0
  65. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOCK +0 -0
  66. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOG +3 -0
  67. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/MANIFEST-000001 +0 -0
  68. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Top Sites +0 -0
  69. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Vpn Tokens +0 -0
  70. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Web Data +0 -0
  71. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/Web Data-journal +0 -0
  72. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager +0 -0
  73. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager-journal +0 -0
  74. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/heavy_ad_intervention_opt_out.db +0 -0
  75. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/LOCK +0 -0
  76. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/LOG +3 -0
  77. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/MANIFEST-000001 +0 -0
  78. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOCK +0 -0
  79. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOG +3 -0
  80. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/MANIFEST-000001 +0 -0
  81. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/DeferredBrowserMetrics/BrowserMetrics-69CAD063-BE24.pma +0 -0
  82. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Local State +1 -0
  83. package/launcher/bin/mailx-app.exe.WebView2/EBWebView/Variations +1 -0
  84. package/launcher/bin/mailx-app.old.exe +0 -0
  85. package/package.json +1 -1
  86. package/packages/mailx-api/index.js +79 -26
  87. package/packages/mailx-core/index.d.ts +129 -0
  88. package/packages/mailx-core/index.js +323 -0
  89. package/packages/mailx-core/ipc.d.ts +13 -0
  90. package/packages/mailx-core/ipc.js +56 -0
  91. package/packages/mailx-core/package.json +18 -0
  92. package/packages/mailx-imap/index.d.ts +5 -1
  93. package/packages/mailx-imap/index.js +76 -14
  94. package/packages/mailx-server/index.js +42 -31
  95. package/packages/mailx-server/package.json +1 -2
  96. package/packages/mailx-settings/index.d.ts +1 -1
  97. package/packages/mailx-settings/index.js +21 -12
  98. package/packages/mailx-store/db.d.ts +5 -1
  99. package/packages/mailx-store/db.js +64 -12
  100. package/packages/mailx-store/file-store.d.ts +2 -8
  101. package/packages/mailx-store/file-store.js +7 -31
  102. package/packages/mailx-types/index.d.ts +3 -1
  103. package/.tswalk.json +0 -7396
  104. package/launcher/release.cmd +0 -4
  105. package/mailx.json +0 -9
  106. package/packages/mailx-api/node_modules/nodemailer/.ncurc.js +0 -9
  107. package/packages/mailx-api/node_modules/nodemailer/.prettierignore +0 -8
  108. package/packages/mailx-api/node_modules/nodemailer/.prettierrc +0 -12
  109. package/packages/mailx-api/node_modules/nodemailer/.prettierrc.js +0 -10
  110. package/packages/mailx-api/node_modules/nodemailer/.release-please-config.json +0 -9
  111. package/packages/mailx-api/node_modules/nodemailer/LICENSE +0 -16
  112. package/packages/mailx-api/node_modules/nodemailer/README.md +0 -86
  113. package/packages/mailx-api/node_modules/nodemailer/SECURITY.txt +0 -22
  114. package/packages/mailx-api/node_modules/nodemailer/eslint.config.js +0 -88
  115. package/packages/mailx-api/node_modules/nodemailer/lib/addressparser/index.js +0 -383
  116. package/packages/mailx-api/node_modules/nodemailer/lib/base64/index.js +0 -139
  117. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/index.js +0 -253
  118. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
  119. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  120. package/packages/mailx-api/node_modules/nodemailer/lib/dkim/sign.js +0 -117
  121. package/packages/mailx-api/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
  122. package/packages/mailx-api/node_modules/nodemailer/lib/fetch/index.js +0 -280
  123. package/packages/mailx-api/node_modules/nodemailer/lib/json-transport/index.js +0 -82
  124. package/packages/mailx-api/node_modules/nodemailer/lib/mail-composer/index.js +0 -629
  125. package/packages/mailx-api/node_modules/nodemailer/lib/mailer/index.js +0 -441
  126. package/packages/mailx-api/node_modules/nodemailer/lib/mailer/mail-message.js +0 -316
  127. package/packages/mailx-api/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
  128. package/packages/mailx-api/node_modules/nodemailer/lib/mime-funcs/mime-types.js +0 -2113
  129. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/index.js +0 -1316
  130. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/last-newline.js +0 -33
  131. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/le-unix.js +0 -43
  132. package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/le-windows.js +0 -52
  133. package/packages/mailx-api/node_modules/nodemailer/lib/nodemailer.js +0 -157
  134. package/packages/mailx-api/node_modules/nodemailer/lib/punycode/index.js +0 -460
  135. package/packages/mailx-api/node_modules/nodemailer/lib/qp/index.js +0 -227
  136. package/packages/mailx-api/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
  137. package/packages/mailx-api/node_modules/nodemailer/lib/ses-transport/index.js +0 -234
  138. package/packages/mailx-api/node_modules/nodemailer/lib/shared/index.js +0 -754
  139. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
  140. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
  141. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1870
  142. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-pool/index.js +0 -652
  143. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +0 -259
  144. package/packages/mailx-api/node_modules/nodemailer/lib/smtp-transport/index.js +0 -421
  145. package/packages/mailx-api/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
  146. package/packages/mailx-api/node_modules/nodemailer/lib/well-known/index.js +0 -47
  147. package/packages/mailx-api/node_modules/nodemailer/lib/well-known/services.json +0 -611
  148. package/packages/mailx-api/node_modules/nodemailer/lib/xoauth2/index.js +0 -427
  149. package/packages/mailx-api/node_modules/nodemailer/package.json +0 -47
  150. package/packages/mailx-imap/node_modules/nodemailer/.ncurc.js +0 -9
  151. package/packages/mailx-imap/node_modules/nodemailer/.prettierignore +0 -8
  152. package/packages/mailx-imap/node_modules/nodemailer/.prettierrc +0 -12
  153. package/packages/mailx-imap/node_modules/nodemailer/.prettierrc.js +0 -10
  154. package/packages/mailx-imap/node_modules/nodemailer/.release-please-config.json +0 -9
  155. package/packages/mailx-imap/node_modules/nodemailer/LICENSE +0 -16
  156. package/packages/mailx-imap/node_modules/nodemailer/README.md +0 -86
  157. package/packages/mailx-imap/node_modules/nodemailer/SECURITY.txt +0 -22
  158. package/packages/mailx-imap/node_modules/nodemailer/eslint.config.js +0 -88
  159. package/packages/mailx-imap/node_modules/nodemailer/lib/addressparser/index.js +0 -383
  160. package/packages/mailx-imap/node_modules/nodemailer/lib/base64/index.js +0 -139
  161. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/index.js +0 -253
  162. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
  163. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  164. package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/sign.js +0 -117
  165. package/packages/mailx-imap/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
  166. package/packages/mailx-imap/node_modules/nodemailer/lib/fetch/index.js +0 -280
  167. package/packages/mailx-imap/node_modules/nodemailer/lib/json-transport/index.js +0 -82
  168. package/packages/mailx-imap/node_modules/nodemailer/lib/mail-composer/index.js +0 -629
  169. package/packages/mailx-imap/node_modules/nodemailer/lib/mailer/index.js +0 -441
  170. package/packages/mailx-imap/node_modules/nodemailer/lib/mailer/mail-message.js +0 -316
  171. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
  172. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-funcs/mime-types.js +0 -2113
  173. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/index.js +0 -1316
  174. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/last-newline.js +0 -33
  175. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/le-unix.js +0 -43
  176. package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/le-windows.js +0 -52
  177. package/packages/mailx-imap/node_modules/nodemailer/lib/nodemailer.js +0 -157
  178. package/packages/mailx-imap/node_modules/nodemailer/lib/punycode/index.js +0 -460
  179. package/packages/mailx-imap/node_modules/nodemailer/lib/qp/index.js +0 -227
  180. package/packages/mailx-imap/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
  181. package/packages/mailx-imap/node_modules/nodemailer/lib/ses-transport/index.js +0 -234
  182. package/packages/mailx-imap/node_modules/nodemailer/lib/shared/index.js +0 -754
  183. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
  184. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
  185. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1870
  186. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-pool/index.js +0 -652
  187. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +0 -259
  188. package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-transport/index.js +0 -421
  189. package/packages/mailx-imap/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
  190. package/packages/mailx-imap/node_modules/nodemailer/lib/well-known/index.js +0 -47
  191. package/packages/mailx-imap/node_modules/nodemailer/lib/well-known/services.json +0 -611
  192. package/packages/mailx-imap/node_modules/nodemailer/lib/xoauth2/index.js +0 -427
  193. package/packages/mailx-imap/node_modules/nodemailer/package.json +0 -47
  194. package/packages/mailx-send/node_modules/nodemailer/.ncurc.js +0 -9
  195. package/packages/mailx-send/node_modules/nodemailer/.prettierignore +0 -8
  196. package/packages/mailx-send/node_modules/nodemailer/.prettierrc +0 -12
  197. package/packages/mailx-send/node_modules/nodemailer/.prettierrc.js +0 -10
  198. package/packages/mailx-send/node_modules/nodemailer/.release-please-config.json +0 -9
  199. package/packages/mailx-send/node_modules/nodemailer/LICENSE +0 -16
  200. package/packages/mailx-send/node_modules/nodemailer/README.md +0 -86
  201. package/packages/mailx-send/node_modules/nodemailer/SECURITY.txt +0 -22
  202. package/packages/mailx-send/node_modules/nodemailer/eslint.config.js +0 -88
  203. package/packages/mailx-send/node_modules/nodemailer/lib/addressparser/index.js +0 -383
  204. package/packages/mailx-send/node_modules/nodemailer/lib/base64/index.js +0 -139
  205. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/index.js +0 -253
  206. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
  207. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  208. package/packages/mailx-send/node_modules/nodemailer/lib/dkim/sign.js +0 -117
  209. package/packages/mailx-send/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
  210. package/packages/mailx-send/node_modules/nodemailer/lib/fetch/index.js +0 -280
  211. package/packages/mailx-send/node_modules/nodemailer/lib/json-transport/index.js +0 -82
  212. package/packages/mailx-send/node_modules/nodemailer/lib/mail-composer/index.js +0 -629
  213. package/packages/mailx-send/node_modules/nodemailer/lib/mailer/index.js +0 -441
  214. package/packages/mailx-send/node_modules/nodemailer/lib/mailer/mail-message.js +0 -316
  215. package/packages/mailx-send/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
  216. package/packages/mailx-send/node_modules/nodemailer/lib/mime-funcs/mime-types.js +0 -2113
  217. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/index.js +0 -1316
  218. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/last-newline.js +0 -33
  219. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/le-unix.js +0 -43
  220. package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/le-windows.js +0 -52
  221. package/packages/mailx-send/node_modules/nodemailer/lib/nodemailer.js +0 -157
  222. package/packages/mailx-send/node_modules/nodemailer/lib/punycode/index.js +0 -460
  223. package/packages/mailx-send/node_modules/nodemailer/lib/qp/index.js +0 -227
  224. package/packages/mailx-send/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
  225. package/packages/mailx-send/node_modules/nodemailer/lib/ses-transport/index.js +0 -234
  226. package/packages/mailx-send/node_modules/nodemailer/lib/shared/index.js +0 -754
  227. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
  228. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
  229. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1870
  230. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-pool/index.js +0 -652
  231. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +0 -259
  232. package/packages/mailx-send/node_modules/nodemailer/lib/smtp-transport/index.js +0 -421
  233. package/packages/mailx-send/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
  234. package/packages/mailx-send/node_modules/nodemailer/lib/well-known/index.js +0 -47
  235. package/packages/mailx-send/node_modules/nodemailer/lib/well-known/services.json +0 -611
  236. package/packages/mailx-send/node_modules/nodemailer/lib/xoauth2/index.js +0 -427
  237. package/packages/mailx-send/node_modules/nodemailer/package.json +0 -47
@@ -1,259 +0,0 @@
1
- 'use strict';
2
-
3
- const SMTPConnection = require('../smtp-connection');
4
- const assign = require('../shared').assign;
5
- const XOAuth2 = require('../xoauth2');
6
- const EventEmitter = require('events');
7
-
8
- /**
9
- * Creates an element for the pool
10
- *
11
- * @constructor
12
- * @param {Object} options SMTPPool instance
13
- */
14
- class PoolResource extends EventEmitter {
15
- constructor(pool) {
16
- super();
17
-
18
- this.pool = pool;
19
- this.options = pool.options;
20
- this.logger = this.pool.logger;
21
-
22
- if (this.options.auth) {
23
- switch ((this.options.auth.type || '').toString().toUpperCase()) {
24
- case 'OAUTH2': {
25
- let oauth2 = new XOAuth2(this.options.auth, this.logger);
26
- oauth2.provisionCallback =
27
- (this.pool.mailer && this.pool.mailer.get('oauth2_provision_cb')) || oauth2.provisionCallback;
28
- this.auth = {
29
- type: 'OAUTH2',
30
- user: this.options.auth.user,
31
- oauth2,
32
- method: 'XOAUTH2'
33
- };
34
- oauth2.on('token', token => this.pool.mailer.emit('token', token));
35
- oauth2.on('error', err => this.emit('error', err));
36
- break;
37
- }
38
- default:
39
- if (!this.options.auth.user && !this.options.auth.pass) {
40
- break;
41
- }
42
- this.auth = {
43
- type: (this.options.auth.type || '').toString().toUpperCase() || 'LOGIN',
44
- user: this.options.auth.user,
45
- credentials: {
46
- user: this.options.auth.user || '',
47
- pass: this.options.auth.pass,
48
- options: this.options.auth.options
49
- },
50
- method: (this.options.auth.method || '').trim().toUpperCase() || this.options.authMethod || false
51
- };
52
- }
53
- }
54
-
55
- this._connection = false;
56
- this._connected = false;
57
-
58
- this.messages = 0;
59
- this.available = true;
60
- }
61
-
62
- /**
63
- * Initiates a connection to the SMTP server
64
- *
65
- * @param {Function} callback Callback function to run once the connection is established or failed
66
- */
67
- connect(callback) {
68
- this.pool.getSocket(this.options, (err, socketOptions) => {
69
- if (err) {
70
- return callback(err);
71
- }
72
-
73
- let returned = false;
74
- let options = this.options;
75
- if (socketOptions && socketOptions.connection) {
76
- this.logger.info(
77
- {
78
- tnx: 'proxy',
79
- remoteAddress: socketOptions.connection.remoteAddress,
80
- remotePort: socketOptions.connection.remotePort,
81
- destHost: options.host || '',
82
- destPort: options.port || '',
83
- action: 'connected'
84
- },
85
- 'Using proxied socket from %s:%s to %s:%s',
86
- socketOptions.connection.remoteAddress,
87
- socketOptions.connection.remotePort,
88
- options.host || '',
89
- options.port || ''
90
- );
91
-
92
- options = assign(false, options);
93
- Object.keys(socketOptions).forEach(key => {
94
- options[key] = socketOptions[key];
95
- });
96
- }
97
-
98
- this.connection = new SMTPConnection(options);
99
-
100
- this.connection.once('error', err => {
101
- this.emit('error', err);
102
- if (returned) {
103
- return;
104
- }
105
- returned = true;
106
- return callback(err);
107
- });
108
-
109
- this.connection.once('end', () => {
110
- this.close();
111
- if (returned) {
112
- return;
113
- }
114
- returned = true;
115
-
116
- let timer = setTimeout(() => {
117
- if (returned) {
118
- return;
119
- }
120
- // still have not returned, this means we have an unexpected connection close
121
- let err = new Error('Unexpected socket close');
122
- if (this.connection && this.connection._socket && this.connection._socket.upgrading) {
123
- // starttls connection errors
124
- err.code = 'ETLS';
125
- }
126
- callback(err);
127
- }, 1000);
128
-
129
- try {
130
- timer.unref();
131
- } catch (_E) {
132
- // Ignore. Happens on envs with non-node timer implementation
133
- }
134
- });
135
-
136
- this.connection.connect(() => {
137
- if (returned) {
138
- return;
139
- }
140
-
141
- if (this.auth && (this.connection.allowsAuth || options.forceAuth)) {
142
- this.connection.login(this.auth, err => {
143
- if (returned) {
144
- return;
145
- }
146
- returned = true;
147
-
148
- if (err) {
149
- this.connection.close();
150
- this.emit('error', err);
151
- return callback(err);
152
- }
153
-
154
- this._connected = true;
155
- callback(null, true);
156
- });
157
- } else {
158
- returned = true;
159
- this._connected = true;
160
- return callback(null, true);
161
- }
162
- });
163
- });
164
- }
165
-
166
- /**
167
- * Sends an e-mail to be sent using the selected settings
168
- *
169
- * @param {Object} mail Mail object
170
- * @param {Function} callback Callback function
171
- */
172
- send(mail, callback) {
173
- if (!this._connected) {
174
- return this.connect(err => {
175
- if (err) {
176
- return callback(err);
177
- }
178
- return this.send(mail, callback);
179
- });
180
- }
181
-
182
- let envelope = mail.message.getEnvelope();
183
- let messageId = mail.message.messageId();
184
-
185
- let recipients = [].concat(envelope.to || []);
186
- if (recipients.length > 3) {
187
- recipients.push('...and ' + recipients.splice(2).length + ' more');
188
- }
189
- this.logger.info(
190
- {
191
- tnx: 'send',
192
- messageId,
193
- cid: this.id
194
- },
195
- 'Sending message %s using #%s to <%s>',
196
- messageId,
197
- this.id,
198
- recipients.join(', ')
199
- );
200
-
201
- if (mail.data.dsn) {
202
- envelope.dsn = mail.data.dsn;
203
- }
204
-
205
- // RFC 8689: Pass requireTLSExtensionEnabled to envelope for MAIL FROM parameter
206
- if (mail.data.requireTLSExtensionEnabled) {
207
- envelope.requireTLSExtensionEnabled = mail.data.requireTLSExtensionEnabled;
208
- }
209
-
210
- this.connection.send(envelope, mail.message.createReadStream(), (err, info) => {
211
- this.messages++;
212
-
213
- if (err) {
214
- this.connection.close();
215
- this.emit('error', err);
216
- return callback(err);
217
- }
218
-
219
- info.envelope = {
220
- from: envelope.from,
221
- to: envelope.to
222
- };
223
- info.messageId = messageId;
224
-
225
- setImmediate(() => {
226
- let err;
227
- if (this.messages >= this.options.maxMessages) {
228
- err = new Error('Resource exhausted');
229
- err.code = 'EMAXLIMIT';
230
- this.connection.close();
231
- this.emit('error', err);
232
- } else {
233
- this.pool._checkRateLimit(() => {
234
- this.available = true;
235
- this.emit('available');
236
- });
237
- }
238
- });
239
-
240
- callback(null, info);
241
- });
242
- }
243
-
244
- /**
245
- * Closes the connection
246
- */
247
- close() {
248
- this._connected = false;
249
- if (this.auth && this.auth.oauth2) {
250
- this.auth.oauth2.removeAllListeners();
251
- }
252
- if (this.connection) {
253
- this.connection.close();
254
- }
255
- this.emit('close');
256
- }
257
- }
258
-
259
- module.exports = PoolResource;
@@ -1,421 +0,0 @@
1
- 'use strict';
2
-
3
- const EventEmitter = require('events');
4
- const SMTPConnection = require('../smtp-connection');
5
- const wellKnown = require('../well-known');
6
- const shared = require('../shared');
7
- const XOAuth2 = require('../xoauth2');
8
- const packageData = require('../../package.json');
9
-
10
- /**
11
- * Creates a SMTP transport object for Nodemailer
12
- *
13
- * @constructor
14
- * @param {Object} options Connection options
15
- */
16
- class SMTPTransport extends EventEmitter {
17
- constructor(options) {
18
- super();
19
-
20
- options = options || {};
21
-
22
- if (typeof options === 'string') {
23
- options = {
24
- url: options
25
- };
26
- }
27
-
28
- let urlData;
29
- let service = options.service;
30
-
31
- if (typeof options.getSocket === 'function') {
32
- this.getSocket = options.getSocket;
33
- }
34
-
35
- if (options.url) {
36
- urlData = shared.parseConnectionUrl(options.url);
37
- service = service || urlData.service;
38
- }
39
-
40
- this.options = shared.assign(
41
- false, // create new object
42
- options, // regular options
43
- urlData, // url options
44
- service && wellKnown(service) // wellknown options
45
- );
46
-
47
- this.logger = shared.getLogger(this.options, {
48
- component: this.options.component || 'smtp-transport'
49
- });
50
-
51
- // temporary object
52
- let connection = new SMTPConnection(this.options);
53
-
54
- this.name = 'SMTP';
55
- this.version = packageData.version + '[client:' + connection.version + ']';
56
-
57
- if (this.options.auth) {
58
- this.auth = this.getAuth({});
59
- }
60
- }
61
-
62
- /**
63
- * Placeholder function for creating proxy sockets. This method immediatelly returns
64
- * without a socket
65
- *
66
- * @param {Object} options Connection options
67
- * @param {Function} callback Callback function to run with the socket keys
68
- */
69
- getSocket(options, callback) {
70
- // return immediatelly
71
- return setImmediate(() => callback(null, false));
72
- }
73
-
74
- getAuth(authOpts) {
75
- if (!authOpts) {
76
- return this.auth;
77
- }
78
-
79
- let hasAuth = false;
80
- let authData = {};
81
-
82
- if (this.options.auth && typeof this.options.auth === 'object') {
83
- Object.keys(this.options.auth).forEach(key => {
84
- hasAuth = true;
85
- authData[key] = this.options.auth[key];
86
- });
87
- }
88
-
89
- if (authOpts && typeof authOpts === 'object') {
90
- Object.keys(authOpts).forEach(key => {
91
- hasAuth = true;
92
- authData[key] = authOpts[key];
93
- });
94
- }
95
-
96
- if (!hasAuth) {
97
- return false;
98
- }
99
-
100
- switch ((authData.type || '').toString().toUpperCase()) {
101
- case 'OAUTH2': {
102
- if (!authData.service && !authData.user) {
103
- return false;
104
- }
105
- let oauth2 = new XOAuth2(authData, this.logger);
106
- oauth2.provisionCallback = (this.mailer && this.mailer.get('oauth2_provision_cb')) || oauth2.provisionCallback;
107
- oauth2.on('token', token => this.mailer.emit('token', token));
108
- oauth2.on('error', err => this.emit('error', err));
109
- return {
110
- type: 'OAUTH2',
111
- user: authData.user,
112
- oauth2,
113
- method: 'XOAUTH2'
114
- };
115
- }
116
- default:
117
- return {
118
- type: (authData.type || '').toString().toUpperCase() || 'LOGIN',
119
- user: authData.user,
120
- credentials: {
121
- user: authData.user || '',
122
- pass: authData.pass,
123
- options: authData.options
124
- },
125
- method: (authData.method || '').trim().toUpperCase() || this.options.authMethod || false
126
- };
127
- }
128
- }
129
-
130
- /**
131
- * Sends an e-mail using the selected settings
132
- *
133
- * @param {Object} mail Mail object
134
- * @param {Function} callback Callback function
135
- */
136
- send(mail, callback) {
137
- this.getSocket(this.options, (err, socketOptions) => {
138
- if (err) {
139
- return callback(err);
140
- }
141
-
142
- let returned = false;
143
- let options = this.options;
144
- if (socketOptions && socketOptions.connection) {
145
- this.logger.info(
146
- {
147
- tnx: 'proxy',
148
- remoteAddress: socketOptions.connection.remoteAddress,
149
- remotePort: socketOptions.connection.remotePort,
150
- destHost: options.host || '',
151
- destPort: options.port || '',
152
- action: 'connected'
153
- },
154
- 'Using proxied socket from %s:%s to %s:%s',
155
- socketOptions.connection.remoteAddress,
156
- socketOptions.connection.remotePort,
157
- options.host || '',
158
- options.port || ''
159
- );
160
-
161
- // only copy options if we need to modify it
162
- options = shared.assign(false, options);
163
- Object.keys(socketOptions).forEach(key => {
164
- options[key] = socketOptions[key];
165
- });
166
- }
167
-
168
- let connection = new SMTPConnection(options);
169
-
170
- connection.once('error', err => {
171
- if (returned) {
172
- return;
173
- }
174
- returned = true;
175
- connection.close();
176
- return callback(err);
177
- });
178
-
179
- connection.once('end', () => {
180
- if (returned) {
181
- return;
182
- }
183
-
184
- let timer = setTimeout(() => {
185
- if (returned) {
186
- return;
187
- }
188
- returned = true;
189
- // still have not returned, this means we have an unexpected connection close
190
- let err = new Error('Unexpected socket close');
191
- if (connection && connection._socket && connection._socket.upgrading) {
192
- // starttls connection errors
193
- err.code = 'ETLS';
194
- }
195
- callback(err);
196
- }, 1000);
197
-
198
- try {
199
- timer.unref();
200
- } catch (_E) {
201
- // Ignore. Happens on envs with non-node timer implementation
202
- }
203
- });
204
-
205
- let sendMessage = () => {
206
- let envelope = mail.message.getEnvelope();
207
- let messageId = mail.message.messageId();
208
-
209
- let recipients = [].concat(envelope.to || []);
210
- if (recipients.length > 3) {
211
- recipients.push('...and ' + recipients.splice(2).length + ' more');
212
- }
213
-
214
- if (mail.data.dsn) {
215
- envelope.dsn = mail.data.dsn;
216
- }
217
-
218
- // RFC 8689: Pass requireTLSExtensionEnabled to envelope for MAIL FROM parameter
219
- if (mail.data.requireTLSExtensionEnabled) {
220
- envelope.requireTLSExtensionEnabled = mail.data.requireTLSExtensionEnabled;
221
- }
222
-
223
- this.logger.info(
224
- {
225
- tnx: 'send',
226
- messageId
227
- },
228
- 'Sending message %s to <%s>',
229
- messageId,
230
- recipients.join(', ')
231
- );
232
-
233
- connection.send(envelope, mail.message.createReadStream(), (err, info) => {
234
- returned = true;
235
- connection.close();
236
- if (err) {
237
- this.logger.error(
238
- {
239
- err,
240
- tnx: 'send'
241
- },
242
- 'Send error for %s: %s',
243
- messageId,
244
- err.message
245
- );
246
- return callback(err);
247
- }
248
- info.envelope = {
249
- from: envelope.from,
250
- to: envelope.to
251
- };
252
- info.messageId = messageId;
253
- try {
254
- return callback(null, info);
255
- } catch (E) {
256
- this.logger.error(
257
- {
258
- err: E,
259
- tnx: 'callback'
260
- },
261
- 'Callback error for %s: %s',
262
- messageId,
263
- E.message
264
- );
265
- }
266
- });
267
- };
268
-
269
- connection.connect(() => {
270
- if (returned) {
271
- return;
272
- }
273
-
274
- let auth = this.getAuth(mail.data.auth);
275
-
276
- if (auth && (connection.allowsAuth || options.forceAuth)) {
277
- connection.login(auth, err => {
278
- if (auth && auth !== this.auth && auth.oauth2) {
279
- auth.oauth2.removeAllListeners();
280
- }
281
- if (returned) {
282
- return;
283
- }
284
-
285
- if (err) {
286
- returned = true;
287
- connection.close();
288
- return callback(err);
289
- }
290
-
291
- sendMessage();
292
- });
293
- } else {
294
- sendMessage();
295
- }
296
- });
297
- });
298
- }
299
-
300
- /**
301
- * Verifies SMTP configuration
302
- *
303
- * @param {Function} callback Callback function
304
- */
305
- verify(callback) {
306
- let promise;
307
-
308
- if (!callback) {
309
- promise = new Promise((resolve, reject) => {
310
- callback = shared.callbackPromise(resolve, reject);
311
- });
312
- }
313
-
314
- this.getSocket(this.options, (err, socketOptions) => {
315
- if (err) {
316
- return callback(err);
317
- }
318
-
319
- let options = this.options;
320
- if (socketOptions && socketOptions.connection) {
321
- this.logger.info(
322
- {
323
- tnx: 'proxy',
324
- remoteAddress: socketOptions.connection.remoteAddress,
325
- remotePort: socketOptions.connection.remotePort,
326
- destHost: options.host || '',
327
- destPort: options.port || '',
328
- action: 'connected'
329
- },
330
- 'Using proxied socket from %s:%s to %s:%s',
331
- socketOptions.connection.remoteAddress,
332
- socketOptions.connection.remotePort,
333
- options.host || '',
334
- options.port || ''
335
- );
336
-
337
- options = shared.assign(false, options);
338
- Object.keys(socketOptions).forEach(key => {
339
- options[key] = socketOptions[key];
340
- });
341
- }
342
-
343
- let connection = new SMTPConnection(options);
344
- let returned = false;
345
-
346
- connection.once('error', err => {
347
- if (returned) {
348
- return;
349
- }
350
- returned = true;
351
- connection.close();
352
- return callback(err);
353
- });
354
-
355
- connection.once('end', () => {
356
- if (returned) {
357
- return;
358
- }
359
- returned = true;
360
- return callback(new Error('Connection closed'));
361
- });
362
-
363
- let finalize = () => {
364
- if (returned) {
365
- return;
366
- }
367
- returned = true;
368
- connection.quit();
369
- return callback(null, true);
370
- };
371
-
372
- connection.connect(() => {
373
- if (returned) {
374
- return;
375
- }
376
-
377
- let authData = this.getAuth({});
378
-
379
- if (authData && (connection.allowsAuth || options.forceAuth)) {
380
- connection.login(authData, err => {
381
- if (returned) {
382
- return;
383
- }
384
-
385
- if (err) {
386
- returned = true;
387
- connection.close();
388
- return callback(err);
389
- }
390
-
391
- finalize();
392
- });
393
- } else if (!authData && connection.allowsAuth && options.forceAuth) {
394
- let err = new Error('Authentication info was not provided');
395
- err.code = 'NoAuth';
396
-
397
- returned = true;
398
- connection.close();
399
- return callback(err);
400
- } else {
401
- finalize();
402
- }
403
- });
404
- });
405
-
406
- return promise;
407
- }
408
-
409
- /**
410
- * Releases resources
411
- */
412
- close() {
413
- if (this.auth && this.auth.oauth2) {
414
- this.auth.oauth2.removeAllListeners();
415
- }
416
- this.emit('close');
417
- }
418
- }
419
-
420
- // expose to the world
421
- module.exports = SMTPTransport;