@bobfrankston/mailx 1.0.1
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.
- package/.tswalk.json +3366 -0
- package/README.md +160 -0
- package/bin/mailx.js +58 -0
- package/client/app.js +431 -0
- package/client/components/folder-tree.js +286 -0
- package/client/components/message-list.js +230 -0
- package/client/components/message-viewer.js +161 -0
- package/client/compose/compose.css +197 -0
- package/client/compose/compose.html +45 -0
- package/client/compose/compose.js +335 -0
- package/client/favicon.svg +11 -0
- package/client/index.html +100 -0
- package/client/lib/api-client.js +67 -0
- package/client/package.json +9 -0
- package/client/styles/components.css +361 -0
- package/client/styles/layout.css +69 -0
- package/launch.ps1 +20 -0
- package/launcher/Cargo.lock +3167 -0
- package/launcher/Cargo.toml +13 -0
- package/launcher/build.cmd +4 -0
- package/launcher/build.rs +8 -0
- package/launcher/mailx.ico +0 -0
- package/launcher/release.cmd +4 -0
- package/launcher/src/main.rs +371 -0
- package/mailx.cmd +2 -0
- package/mailx.db +0 -0
- package/mailx.db-shm +0 -0
- package/mailx.db-wal +0 -0
- package/mailx.json +9 -0
- package/package.json +51 -0
- package/packages/mailx-api/index.d.ts +9 -0
- package/packages/mailx-api/index.js +375 -0
- package/packages/mailx-api/node_modules/nodemailer/.ncurc.js +9 -0
- package/packages/mailx-api/node_modules/nodemailer/.prettierignore +8 -0
- package/packages/mailx-api/node_modules/nodemailer/.prettierrc +12 -0
- package/packages/mailx-api/node_modules/nodemailer/.prettierrc.js +10 -0
- package/packages/mailx-api/node_modules/nodemailer/.release-please-config.json +9 -0
- package/packages/mailx-api/node_modules/nodemailer/LICENSE +16 -0
- package/packages/mailx-api/node_modules/nodemailer/README.md +86 -0
- package/packages/mailx-api/node_modules/nodemailer/SECURITY.txt +22 -0
- package/packages/mailx-api/node_modules/nodemailer/eslint.config.js +88 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/addressparser/index.js +383 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/base64/index.js +139 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/dkim/index.js +253 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/dkim/sign.js +117 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/fetch/index.js +280 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/json-transport/index.js +82 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mail-composer/index.js +629 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mailer/index.js +441 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mailer/mail-message.js +316 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2113 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/index.js +1316 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/nodemailer.js +157 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/punycode/index.js +460 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/qp/index.js +227 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/ses-transport/index.js +234 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/shared/index.js +754 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/smtp-connection/index.js +1870 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/smtp-pool/index.js +652 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +259 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/smtp-transport/index.js +421 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/well-known/index.js +47 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/well-known/services.json +611 -0
- package/packages/mailx-api/node_modules/nodemailer/lib/xoauth2/index.js +427 -0
- package/packages/mailx-api/node_modules/nodemailer/package.json +47 -0
- package/packages/mailx-api/package.json +24 -0
- package/packages/mailx-api/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-compose/index.d.ts +21 -0
- package/packages/mailx-compose/index.js +61 -0
- package/packages/mailx-compose/package.json +14 -0
- package/packages/mailx-imap/index.d.ts +105 -0
- package/packages/mailx-imap/index.js +1026 -0
- package/packages/mailx-imap/node_modules/nodemailer/.ncurc.js +9 -0
- package/packages/mailx-imap/node_modules/nodemailer/.prettierignore +8 -0
- package/packages/mailx-imap/node_modules/nodemailer/.prettierrc +12 -0
- package/packages/mailx-imap/node_modules/nodemailer/.prettierrc.js +10 -0
- package/packages/mailx-imap/node_modules/nodemailer/.release-please-config.json +9 -0
- package/packages/mailx-imap/node_modules/nodemailer/LICENSE +16 -0
- package/packages/mailx-imap/node_modules/nodemailer/README.md +86 -0
- package/packages/mailx-imap/node_modules/nodemailer/SECURITY.txt +22 -0
- package/packages/mailx-imap/node_modules/nodemailer/eslint.config.js +88 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/addressparser/index.js +383 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/base64/index.js +139 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/index.js +253 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/dkim/sign.js +117 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/fetch/index.js +280 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/json-transport/index.js +82 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mail-composer/index.js +629 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mailer/index.js +441 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mailer/mail-message.js +316 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2113 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/index.js +1316 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/nodemailer.js +157 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/punycode/index.js +460 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/qp/index.js +227 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/ses-transport/index.js +234 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/shared/index.js +754 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-connection/index.js +1870 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-pool/index.js +652 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +259 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/smtp-transport/index.js +421 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/well-known/index.js +47 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/well-known/services.json +611 -0
- package/packages/mailx-imap/node_modules/nodemailer/lib/xoauth2/index.js +427 -0
- package/packages/mailx-imap/node_modules/nodemailer/package.json +47 -0
- package/packages/mailx-imap/package.json +19 -0
- package/packages/mailx-imap/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-send/README.md +217 -0
- package/packages/mailx-send/cli-queue.d.ts +11 -0
- package/packages/mailx-send/cli-queue.js +59 -0
- package/packages/mailx-send/cli-send.d.ts +17 -0
- package/packages/mailx-send/cli-send.js +75 -0
- package/packages/mailx-send/cli.d.ts +22 -0
- package/packages/mailx-send/cli.js +115 -0
- package/packages/mailx-send/index.d.ts +77 -0
- package/packages/mailx-send/index.js +264 -0
- package/packages/mailx-send/mailsend/README.md +133 -0
- package/packages/mailx-send/mailsend/cli.d.ts +12 -0
- package/packages/mailx-send/mailsend/cli.js +70 -0
- package/packages/mailx-send/mailsend/index.d.ts +77 -0
- package/packages/mailx-send/mailsend/index.js +264 -0
- package/packages/mailx-send/mailsend/node_modules/.package-lock.json +49 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/LICENSE +21 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/README.md +15 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/assert.d.ts +1078 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/async_hooks.d.ts +603 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/buffer.d.ts +1934 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/child_process.d.ts +1476 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/cluster.d.ts +578 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/console.d.ts +452 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/constants.d.ts +21 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/crypto.d.ts +4545 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/dgram.d.ts +600 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/dns.d.ts +923 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/domain.d.ts +170 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/events.d.ts +976 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/fs/promises.d.ts +1295 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/fs.d.ts +4461 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/globals.d.ts +172 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/http.d.ts +2089 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/http2.d.ts +2644 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/https.d.ts +579 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/index.d.ts +97 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/inspector.d.ts +253 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/module.d.ts +891 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/net.d.ts +1057 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/os.d.ts +506 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/package.json +145 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/path.d.ts +200 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/perf_hooks.d.ts +968 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/process.d.ts +2084 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/punycode.d.ts +117 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/querystring.d.ts +152 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/readline.d.ts +594 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/repl.d.ts +428 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/sea.d.ts +153 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/sqlite.d.ts +721 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/stream/web.d.ts +622 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/stream.d.ts +1664 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/test.d.ts +2163 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/timers.d.ts +287 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/tls.d.ts +1319 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/trace_events.d.ts +197 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/ts5.6/index.d.ts +97 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/tty.d.ts +208 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/url.d.ts +984 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/util.d.ts +2606 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/v8.d.ts +920 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/vm.d.ts +1000 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/wasi.d.ts +181 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/worker_threads.d.ts +784 -0
- package/packages/mailx-send/mailsend/node_modules/@types/node/zlib.d.ts +747 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/LICENSE +21 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/README.md +15 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/index.d.ts +82 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/addressparser/index.d.ts +31 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/base64/index.d.ts +22 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/index.d.ts +45 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/message-parser.d.ts +75 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/relaxed-body.d.ts +75 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/dkim/sign.d.ts +21 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/fetch/cookies.d.ts +54 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/fetch/index.d.ts +38 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/json-transport/index.d.ts +53 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mail-composer/index.d.ts +25 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mailer/index.d.ts +283 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mailer/mail-message.d.ts +32 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-funcs/index.d.ts +87 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-funcs/mime-types.d.ts +2 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-node/index.d.ts +224 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/mime-node/last-newline.d.ts +9 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/qp/index.d.ts +23 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/sendmail-transport/index.d.ts +53 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/sendmail-transport/le-unix.d.ts +7 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/sendmail-transport/le-windows.d.ts +7 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/ses-transport/index.d.ts +146 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/shared/index.d.ts +58 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-connection/data-stream.d.ts +11 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-connection/http-proxy-client.d.ts +16 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-connection/index.d.ts +270 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-pool/index.d.ts +93 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-pool/pool-resource.d.ts +66 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/smtp-transport/index.d.ts +115 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/stream-transport/index.d.ts +59 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/well-known/index.d.ts +6 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/lib/xoauth2/index.d.ts +114 -0
- package/packages/mailx-send/mailsend/node_modules/@types/nodemailer/package.json +38 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/.ncurc.js +9 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/.prettierignore +8 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/.prettierrc +12 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/.prettierrc.js +10 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/.release-please-config.json +9 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/LICENSE +16 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/README.md +86 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/SECURITY.txt +22 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/eslint.config.js +88 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/addressparser/index.js +383 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/base64/index.js +139 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/index.js +253 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/dkim/sign.js +117 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/fetch/index.js +280 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/json-transport/index.js +82 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mail-composer/index.js +629 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mailer/index.js +441 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mailer/mail-message.js +316 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2113 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/index.js +1316 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/nodemailer.js +157 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/punycode/index.js +460 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/qp/index.js +227 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/ses-transport/index.js +234 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/shared/index.js +754 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-connection/index.js +1870 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-pool/index.js +652 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +259 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/smtp-transport/index.js +421 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/well-known/index.js +47 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/well-known/services.json +611 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/lib/xoauth2/index.js +427 -0
- package/packages/mailx-send/mailsend/node_modules/nodemailer/package.json +47 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/LICENSE +21 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/README.md +6 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/agent.d.ts +31 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/api.d.ts +43 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/cache.d.ts +36 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/client.d.ts +108 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/connector.d.ts +34 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/content-type.d.ts +21 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/cookies.d.ts +28 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/dispatcher.d.ts +256 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/errors.d.ts +149 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/eventsource.d.ts +61 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/fetch.d.ts +209 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/file.d.ts +39 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/filereader.d.ts +54 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/formdata.d.ts +108 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/global-origin.d.ts +7 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/handlers.d.ts +15 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/header.d.ts +4 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/index.d.ts +71 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/interceptors.d.ts +17 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/mock-client.d.ts +25 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/package.json +55 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/patch.d.ts +33 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/pool.d.ts +39 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/readable.d.ts +65 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/util.d.ts +18 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/webidl.d.ts +228 -0
- package/packages/mailx-send/mailsend/node_modules/undici-types/websocket.d.ts +150 -0
- package/packages/mailx-send/mailsend/package.json +26 -0
- package/packages/mailx-send/node_modules/.package-lock.json +49 -0
- package/packages/mailx-send/node_modules/@types/node/LICENSE +21 -0
- package/packages/mailx-send/node_modules/@types/node/README.md +15 -0
- package/packages/mailx-send/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/packages/mailx-send/node_modules/@types/node/assert.d.ts +1078 -0
- package/packages/mailx-send/node_modules/@types/node/async_hooks.d.ts +603 -0
- package/packages/mailx-send/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/packages/mailx-send/node_modules/@types/node/buffer.d.ts +1934 -0
- package/packages/mailx-send/node_modules/@types/node/child_process.d.ts +1476 -0
- package/packages/mailx-send/node_modules/@types/node/cluster.d.ts +578 -0
- package/packages/mailx-send/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/packages/mailx-send/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/packages/mailx-send/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/packages/mailx-send/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/packages/mailx-send/node_modules/@types/node/console.d.ts +452 -0
- package/packages/mailx-send/node_modules/@types/node/constants.d.ts +21 -0
- package/packages/mailx-send/node_modules/@types/node/crypto.d.ts +4545 -0
- package/packages/mailx-send/node_modules/@types/node/dgram.d.ts +600 -0
- package/packages/mailx-send/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/packages/mailx-send/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/packages/mailx-send/node_modules/@types/node/dns.d.ts +923 -0
- package/packages/mailx-send/node_modules/@types/node/domain.d.ts +170 -0
- package/packages/mailx-send/node_modules/@types/node/events.d.ts +976 -0
- package/packages/mailx-send/node_modules/@types/node/fs/promises.d.ts +1295 -0
- package/packages/mailx-send/node_modules/@types/node/fs.d.ts +4461 -0
- package/packages/mailx-send/node_modules/@types/node/globals.d.ts +172 -0
- package/packages/mailx-send/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/packages/mailx-send/node_modules/@types/node/http.d.ts +2089 -0
- package/packages/mailx-send/node_modules/@types/node/http2.d.ts +2644 -0
- package/packages/mailx-send/node_modules/@types/node/https.d.ts +579 -0
- package/packages/mailx-send/node_modules/@types/node/index.d.ts +97 -0
- package/packages/mailx-send/node_modules/@types/node/inspector.d.ts +253 -0
- package/packages/mailx-send/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/packages/mailx-send/node_modules/@types/node/module.d.ts +891 -0
- package/packages/mailx-send/node_modules/@types/node/net.d.ts +1057 -0
- package/packages/mailx-send/node_modules/@types/node/os.d.ts +506 -0
- package/packages/mailx-send/node_modules/@types/node/package.json +145 -0
- package/packages/mailx-send/node_modules/@types/node/path.d.ts +200 -0
- package/packages/mailx-send/node_modules/@types/node/perf_hooks.d.ts +968 -0
- package/packages/mailx-send/node_modules/@types/node/process.d.ts +2084 -0
- package/packages/mailx-send/node_modules/@types/node/punycode.d.ts +117 -0
- package/packages/mailx-send/node_modules/@types/node/querystring.d.ts +152 -0
- package/packages/mailx-send/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/packages/mailx-send/node_modules/@types/node/readline.d.ts +594 -0
- package/packages/mailx-send/node_modules/@types/node/repl.d.ts +428 -0
- package/packages/mailx-send/node_modules/@types/node/sea.d.ts +153 -0
- package/packages/mailx-send/node_modules/@types/node/sqlite.d.ts +721 -0
- package/packages/mailx-send/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/packages/mailx-send/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/packages/mailx-send/node_modules/@types/node/stream/web.d.ts +622 -0
- package/packages/mailx-send/node_modules/@types/node/stream.d.ts +1664 -0
- package/packages/mailx-send/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/packages/mailx-send/node_modules/@types/node/test.d.ts +2163 -0
- package/packages/mailx-send/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/packages/mailx-send/node_modules/@types/node/timers.d.ts +287 -0
- package/packages/mailx-send/node_modules/@types/node/tls.d.ts +1319 -0
- package/packages/mailx-send/node_modules/@types/node/trace_events.d.ts +197 -0
- package/packages/mailx-send/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/packages/mailx-send/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/packages/mailx-send/node_modules/@types/node/ts5.6/index.d.ts +97 -0
- package/packages/mailx-send/node_modules/@types/node/tty.d.ts +208 -0
- package/packages/mailx-send/node_modules/@types/node/url.d.ts +984 -0
- package/packages/mailx-send/node_modules/@types/node/util.d.ts +2606 -0
- package/packages/mailx-send/node_modules/@types/node/v8.d.ts +920 -0
- package/packages/mailx-send/node_modules/@types/node/vm.d.ts +1000 -0
- package/packages/mailx-send/node_modules/@types/node/wasi.d.ts +181 -0
- package/packages/mailx-send/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/packages/mailx-send/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/packages/mailx-send/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/packages/mailx-send/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/packages/mailx-send/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/packages/mailx-send/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/packages/mailx-send/node_modules/@types/node/worker_threads.d.ts +784 -0
- package/packages/mailx-send/node_modules/@types/node/zlib.d.ts +747 -0
- package/packages/mailx-send/node_modules/nodemailer/.ncurc.js +9 -0
- package/packages/mailx-send/node_modules/nodemailer/.prettierignore +8 -0
- package/packages/mailx-send/node_modules/nodemailer/.prettierrc +12 -0
- package/packages/mailx-send/node_modules/nodemailer/.prettierrc.js +10 -0
- package/packages/mailx-send/node_modules/nodemailer/.release-please-config.json +9 -0
- package/packages/mailx-send/node_modules/nodemailer/LICENSE +16 -0
- package/packages/mailx-send/node_modules/nodemailer/README.md +86 -0
- package/packages/mailx-send/node_modules/nodemailer/SECURITY.txt +22 -0
- package/packages/mailx-send/node_modules/nodemailer/eslint.config.js +88 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/addressparser/index.js +383 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/base64/index.js +139 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/dkim/index.js +253 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/dkim/sign.js +117 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/fetch/index.js +280 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/json-transport/index.js +82 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mail-composer/index.js +629 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mailer/index.js +441 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mailer/mail-message.js +316 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mime-funcs/index.js +625 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2113 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/index.js +1316 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/nodemailer.js +157 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/punycode/index.js +460 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/qp/index.js +227 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/ses-transport/index.js +234 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/shared/index.js +754 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/smtp-connection/index.js +1870 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/smtp-pool/index.js +652 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +259 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/smtp-transport/index.js +421 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/well-known/index.js +47 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/well-known/services.json +611 -0
- package/packages/mailx-send/node_modules/nodemailer/lib/xoauth2/index.js +427 -0
- package/packages/mailx-send/node_modules/nodemailer/package.json +47 -0
- package/packages/mailx-send/node_modules/undici-types/LICENSE +21 -0
- package/packages/mailx-send/node_modules/undici-types/README.md +6 -0
- package/packages/mailx-send/node_modules/undici-types/agent.d.ts +31 -0
- package/packages/mailx-send/node_modules/undici-types/api.d.ts +43 -0
- package/packages/mailx-send/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/packages/mailx-send/node_modules/undici-types/cache.d.ts +36 -0
- package/packages/mailx-send/node_modules/undici-types/client.d.ts +108 -0
- package/packages/mailx-send/node_modules/undici-types/connector.d.ts +34 -0
- package/packages/mailx-send/node_modules/undici-types/content-type.d.ts +21 -0
- package/packages/mailx-send/node_modules/undici-types/cookies.d.ts +28 -0
- package/packages/mailx-send/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/packages/mailx-send/node_modules/undici-types/dispatcher.d.ts +256 -0
- package/packages/mailx-send/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/packages/mailx-send/node_modules/undici-types/errors.d.ts +149 -0
- package/packages/mailx-send/node_modules/undici-types/eventsource.d.ts +61 -0
- package/packages/mailx-send/node_modules/undici-types/fetch.d.ts +209 -0
- package/packages/mailx-send/node_modules/undici-types/file.d.ts +39 -0
- package/packages/mailx-send/node_modules/undici-types/filereader.d.ts +54 -0
- package/packages/mailx-send/node_modules/undici-types/formdata.d.ts +108 -0
- package/packages/mailx-send/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/packages/mailx-send/node_modules/undici-types/global-origin.d.ts +7 -0
- package/packages/mailx-send/node_modules/undici-types/handlers.d.ts +15 -0
- package/packages/mailx-send/node_modules/undici-types/header.d.ts +4 -0
- package/packages/mailx-send/node_modules/undici-types/index.d.ts +71 -0
- package/packages/mailx-send/node_modules/undici-types/interceptors.d.ts +17 -0
- package/packages/mailx-send/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/packages/mailx-send/node_modules/undici-types/mock-client.d.ts +25 -0
- package/packages/mailx-send/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/packages/mailx-send/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/packages/mailx-send/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/packages/mailx-send/node_modules/undici-types/package.json +55 -0
- package/packages/mailx-send/node_modules/undici-types/patch.d.ts +33 -0
- package/packages/mailx-send/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/packages/mailx-send/node_modules/undici-types/pool.d.ts +39 -0
- package/packages/mailx-send/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/packages/mailx-send/node_modules/undici-types/readable.d.ts +65 -0
- package/packages/mailx-send/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/packages/mailx-send/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/packages/mailx-send/node_modules/undici-types/util.d.ts +18 -0
- package/packages/mailx-send/node_modules/undici-types/webidl.d.ts +228 -0
- package/packages/mailx-send/node_modules/undici-types/websocket.d.ts +150 -0
- package/packages/mailx-send/package.json +27 -0
- package/packages/mailx-server/index.d.ts +8 -0
- package/packages/mailx-server/index.js +217 -0
- package/packages/mailx-server/package.json +25 -0
- package/packages/mailx-server/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-settings/index.d.ts +64 -0
- package/packages/mailx-settings/index.js +218 -0
- package/packages/mailx-settings/package.json +16 -0
- package/packages/mailx-settings/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-store/db.d.ts +100 -0
- package/packages/mailx-store/db.js +461 -0
- package/packages/mailx-store/file-store.d.ts +22 -0
- package/packages/mailx-store/file-store.js +59 -0
- package/packages/mailx-store/index.d.ts +7 -0
- package/packages/mailx-store/index.js +7 -0
- package/packages/mailx-store/package.json +19 -0
- package/packages/mailx-store/tsconfig.tsbuildinfo +1 -0
- package/packages/mailx-types/index.d.ts +195 -0
- package/packages/mailx-types/index.js +7 -0
- package/packages/mailx-types/package.json +12 -0
- package/packages/mailx-types/tsconfig.tsbuildinfo +1 -0
- package/tsconfig.base.json +28 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Stream = require('stream').Stream;
|
|
4
|
+
const nmfetch = require('../fetch');
|
|
5
|
+
const crypto = require('crypto');
|
|
6
|
+
const shared = require('../shared');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* XOAUTH2 access_token generator for Gmail.
|
|
10
|
+
* Create client ID for web applications in Google API console to use it.
|
|
11
|
+
* See Offline Access for receiving the needed refreshToken for an user
|
|
12
|
+
* https://developers.google.com/accounts/docs/OAuth2WebServer#offline
|
|
13
|
+
*
|
|
14
|
+
* Usage for generating access tokens with a custom method using provisionCallback:
|
|
15
|
+
* provisionCallback(user, renew, callback)
|
|
16
|
+
* * user is the username to get the token for
|
|
17
|
+
* * renew is a boolean that if true indicates that existing token failed and needs to be renewed
|
|
18
|
+
* * callback is the callback to run with (error, accessToken [, expires])
|
|
19
|
+
* * accessToken is a string
|
|
20
|
+
* * expires is an optional expire time in milliseconds
|
|
21
|
+
* If provisionCallback is used, then Nodemailer does not try to attempt generating the token by itself
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
* @param {Object} options Client information for token generation
|
|
25
|
+
* @param {String} options.user User e-mail address
|
|
26
|
+
* @param {String} options.clientId Client ID value
|
|
27
|
+
* @param {String} options.clientSecret Client secret value
|
|
28
|
+
* @param {String} options.refreshToken Refresh token for an user
|
|
29
|
+
* @param {String} options.accessUrl Endpoint for token generation, defaults to 'https://accounts.google.com/o/oauth2/token'
|
|
30
|
+
* @param {String} options.accessToken An existing valid accessToken
|
|
31
|
+
* @param {String} options.privateKey Private key for JSW
|
|
32
|
+
* @param {Number} options.expires Optional Access Token expire time in ms
|
|
33
|
+
* @param {Number} options.timeout Optional TTL for Access Token in seconds
|
|
34
|
+
* @param {Function} options.provisionCallback Function to run when a new access token is required
|
|
35
|
+
*/
|
|
36
|
+
class XOAuth2 extends Stream {
|
|
37
|
+
constructor(options, logger) {
|
|
38
|
+
super();
|
|
39
|
+
|
|
40
|
+
this.options = options || {};
|
|
41
|
+
|
|
42
|
+
if (options && options.serviceClient) {
|
|
43
|
+
if (!options.privateKey || !options.user) {
|
|
44
|
+
setImmediate(() => this.emit('error', new Error('Options "privateKey" and "user" are required for service account!')));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let serviceRequestTimeout = Math.min(Math.max(Number(this.options.serviceRequestTimeout) || 0, 0), 3600);
|
|
49
|
+
this.options.serviceRequestTimeout = serviceRequestTimeout || 5 * 60;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.logger = shared.getLogger(
|
|
53
|
+
{
|
|
54
|
+
logger
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
component: this.options.component || 'OAuth2'
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
this.provisionCallback = typeof this.options.provisionCallback === 'function' ? this.options.provisionCallback : false;
|
|
62
|
+
|
|
63
|
+
this.options.accessUrl = this.options.accessUrl || 'https://accounts.google.com/o/oauth2/token';
|
|
64
|
+
this.options.customHeaders = this.options.customHeaders || {};
|
|
65
|
+
this.options.customParams = this.options.customParams || {};
|
|
66
|
+
|
|
67
|
+
this.accessToken = this.options.accessToken || false;
|
|
68
|
+
|
|
69
|
+
if (this.options.expires && Number(this.options.expires)) {
|
|
70
|
+
this.expires = this.options.expires;
|
|
71
|
+
} else {
|
|
72
|
+
let timeout = Math.max(Number(this.options.timeout) || 0, 0);
|
|
73
|
+
this.expires = (timeout && Date.now() + timeout * 1000) || 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.renewing = false; // Track if renewal is in progress
|
|
77
|
+
this.renewalQueue = []; // Queue for pending requests during renewal
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Returns or generates (if previous has expired) a XOAuth2 token
|
|
82
|
+
*
|
|
83
|
+
* @param {Boolean} renew If false then use cached access token (if available)
|
|
84
|
+
* @param {Function} callback Callback function with error object and token string
|
|
85
|
+
*/
|
|
86
|
+
getToken(renew, callback) {
|
|
87
|
+
if (!renew && this.accessToken && (!this.expires || this.expires > Date.now())) {
|
|
88
|
+
this.logger.debug(
|
|
89
|
+
{
|
|
90
|
+
tnx: 'OAUTH2',
|
|
91
|
+
user: this.options.user,
|
|
92
|
+
action: 'reuse'
|
|
93
|
+
},
|
|
94
|
+
'Reusing existing access token for %s',
|
|
95
|
+
this.options.user
|
|
96
|
+
);
|
|
97
|
+
return callback(null, this.accessToken);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// check if it is possible to renew, if not, return the current token or error
|
|
101
|
+
if (!this.provisionCallback && !this.options.refreshToken && !this.options.serviceClient) {
|
|
102
|
+
if (this.accessToken) {
|
|
103
|
+
this.logger.debug(
|
|
104
|
+
{
|
|
105
|
+
tnx: 'OAUTH2',
|
|
106
|
+
user: this.options.user,
|
|
107
|
+
action: 'reuse'
|
|
108
|
+
},
|
|
109
|
+
'Reusing existing access token (no refresh capability) for %s',
|
|
110
|
+
this.options.user
|
|
111
|
+
);
|
|
112
|
+
return callback(null, this.accessToken);
|
|
113
|
+
}
|
|
114
|
+
this.logger.error(
|
|
115
|
+
{
|
|
116
|
+
tnx: 'OAUTH2',
|
|
117
|
+
user: this.options.user,
|
|
118
|
+
action: 'renew'
|
|
119
|
+
},
|
|
120
|
+
'Cannot renew access token for %s: No refresh mechanism available',
|
|
121
|
+
this.options.user
|
|
122
|
+
);
|
|
123
|
+
return callback(new Error("Can't create new access token for user"));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// If renewal already in progress, queue this request instead of starting another
|
|
127
|
+
if (this.renewing) {
|
|
128
|
+
return this.renewalQueue.push({ renew, callback });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
this.renewing = true;
|
|
132
|
+
|
|
133
|
+
// Handles token renewal completion - processes queued requests and cleans up
|
|
134
|
+
const generateCallback = (err, accessToken) => {
|
|
135
|
+
this.renewalQueue.forEach(item => item.callback(err, accessToken));
|
|
136
|
+
this.renewalQueue = [];
|
|
137
|
+
this.renewing = false;
|
|
138
|
+
|
|
139
|
+
if (err) {
|
|
140
|
+
this.logger.error(
|
|
141
|
+
{
|
|
142
|
+
err,
|
|
143
|
+
tnx: 'OAUTH2',
|
|
144
|
+
user: this.options.user,
|
|
145
|
+
action: 'renew'
|
|
146
|
+
},
|
|
147
|
+
'Failed generating new Access Token for %s',
|
|
148
|
+
this.options.user
|
|
149
|
+
);
|
|
150
|
+
} else {
|
|
151
|
+
this.logger.info(
|
|
152
|
+
{
|
|
153
|
+
tnx: 'OAUTH2',
|
|
154
|
+
user: this.options.user,
|
|
155
|
+
action: 'renew'
|
|
156
|
+
},
|
|
157
|
+
'Generated new Access Token for %s',
|
|
158
|
+
this.options.user
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
// Complete original request
|
|
162
|
+
callback(err, accessToken);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
if (this.provisionCallback) {
|
|
166
|
+
this.provisionCallback(this.options.user, !!renew, (err, accessToken, expires) => {
|
|
167
|
+
if (!err && accessToken) {
|
|
168
|
+
this.accessToken = accessToken;
|
|
169
|
+
this.expires = expires || 0;
|
|
170
|
+
}
|
|
171
|
+
generateCallback(err, accessToken);
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
this.generateToken(generateCallback);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Updates token values
|
|
180
|
+
*
|
|
181
|
+
* @param {String} accessToken New access token
|
|
182
|
+
* @param {Number} timeout Access token lifetime in seconds
|
|
183
|
+
*
|
|
184
|
+
* Emits 'token': { user: User email-address, accessToken: the new accessToken, timeout: TTL in seconds}
|
|
185
|
+
*/
|
|
186
|
+
updateToken(accessToken, timeout) {
|
|
187
|
+
this.accessToken = accessToken;
|
|
188
|
+
timeout = Math.max(Number(timeout) || 0, 0);
|
|
189
|
+
this.expires = (timeout && Date.now() + timeout * 1000) || 0;
|
|
190
|
+
|
|
191
|
+
this.emit('token', {
|
|
192
|
+
user: this.options.user,
|
|
193
|
+
accessToken: accessToken || '',
|
|
194
|
+
expires: this.expires
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Generates a new XOAuth2 token with the credentials provided at initialization
|
|
200
|
+
*
|
|
201
|
+
* @param {Function} callback Callback function with error object and token string
|
|
202
|
+
*/
|
|
203
|
+
generateToken(callback) {
|
|
204
|
+
let urlOptions;
|
|
205
|
+
let loggedUrlOptions;
|
|
206
|
+
if (this.options.serviceClient) {
|
|
207
|
+
// service account - https://developers.google.com/identity/protocols/OAuth2ServiceAccount
|
|
208
|
+
let iat = Math.floor(Date.now() / 1000); // unix time
|
|
209
|
+
let tokenData = {
|
|
210
|
+
iss: this.options.serviceClient,
|
|
211
|
+
scope: this.options.scope || 'https://mail.google.com/',
|
|
212
|
+
sub: this.options.user,
|
|
213
|
+
aud: this.options.accessUrl,
|
|
214
|
+
iat,
|
|
215
|
+
exp: iat + this.options.serviceRequestTimeout
|
|
216
|
+
};
|
|
217
|
+
let token;
|
|
218
|
+
try {
|
|
219
|
+
token = this.jwtSignRS256(tokenData);
|
|
220
|
+
} catch (_err) {
|
|
221
|
+
return callback(new Error("Can't generate token. Check your auth options"));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
urlOptions = {
|
|
225
|
+
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
|
|
226
|
+
assertion: token
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
loggedUrlOptions = {
|
|
230
|
+
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
|
|
231
|
+
assertion: tokenData
|
|
232
|
+
};
|
|
233
|
+
} else {
|
|
234
|
+
if (!this.options.refreshToken) {
|
|
235
|
+
return callback(new Error("Can't create new access token for user"));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// web app - https://developers.google.com/identity/protocols/OAuth2WebServer
|
|
239
|
+
urlOptions = {
|
|
240
|
+
client_id: this.options.clientId || '',
|
|
241
|
+
client_secret: this.options.clientSecret || '',
|
|
242
|
+
refresh_token: this.options.refreshToken,
|
|
243
|
+
grant_type: 'refresh_token'
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
loggedUrlOptions = {
|
|
247
|
+
client_id: this.options.clientId || '',
|
|
248
|
+
client_secret: (this.options.clientSecret || '').substr(0, 6) + '...',
|
|
249
|
+
refresh_token: (this.options.refreshToken || '').substr(0, 6) + '...',
|
|
250
|
+
grant_type: 'refresh_token'
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
Object.keys(this.options.customParams).forEach(key => {
|
|
255
|
+
urlOptions[key] = this.options.customParams[key];
|
|
256
|
+
loggedUrlOptions[key] = this.options.customParams[key];
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
this.logger.debug(
|
|
260
|
+
{
|
|
261
|
+
tnx: 'OAUTH2',
|
|
262
|
+
user: this.options.user,
|
|
263
|
+
action: 'generate'
|
|
264
|
+
},
|
|
265
|
+
'Requesting token using: %s',
|
|
266
|
+
JSON.stringify(loggedUrlOptions)
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
this.postRequest(this.options.accessUrl, urlOptions, this.options, (error, body) => {
|
|
270
|
+
let data;
|
|
271
|
+
|
|
272
|
+
if (error) {
|
|
273
|
+
return callback(error);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
try {
|
|
277
|
+
data = JSON.parse(body.toString());
|
|
278
|
+
} catch (E) {
|
|
279
|
+
return callback(E);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (!data || typeof data !== 'object') {
|
|
283
|
+
this.logger.debug(
|
|
284
|
+
{
|
|
285
|
+
tnx: 'OAUTH2',
|
|
286
|
+
user: this.options.user,
|
|
287
|
+
action: 'post'
|
|
288
|
+
},
|
|
289
|
+
'Response: %s',
|
|
290
|
+
(body || '').toString()
|
|
291
|
+
);
|
|
292
|
+
return callback(new Error('Invalid authentication response'));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
let logData = {};
|
|
296
|
+
Object.keys(data).forEach(key => {
|
|
297
|
+
if (key !== 'access_token') {
|
|
298
|
+
logData[key] = data[key];
|
|
299
|
+
} else {
|
|
300
|
+
logData[key] = (data[key] || '').toString().substr(0, 6) + '...';
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
this.logger.debug(
|
|
305
|
+
{
|
|
306
|
+
tnx: 'OAUTH2',
|
|
307
|
+
user: this.options.user,
|
|
308
|
+
action: 'post'
|
|
309
|
+
},
|
|
310
|
+
'Response: %s',
|
|
311
|
+
JSON.stringify(logData)
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
if (data.error) {
|
|
315
|
+
// Error Response : https://tools.ietf.org/html/rfc6749#section-5.2
|
|
316
|
+
let errorMessage = data.error;
|
|
317
|
+
if (data.error_description) {
|
|
318
|
+
errorMessage += ': ' + data.error_description;
|
|
319
|
+
}
|
|
320
|
+
if (data.error_uri) {
|
|
321
|
+
errorMessage += ' (' + data.error_uri + ')';
|
|
322
|
+
}
|
|
323
|
+
return callback(new Error(errorMessage));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (data.access_token) {
|
|
327
|
+
this.updateToken(data.access_token, data.expires_in);
|
|
328
|
+
return callback(null, this.accessToken);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return callback(new Error('No access token'));
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Converts an access_token and user id into a base64 encoded XOAuth2 token
|
|
337
|
+
*
|
|
338
|
+
* @param {String} [accessToken] Access token string
|
|
339
|
+
* @return {String} Base64 encoded token for IMAP or SMTP login
|
|
340
|
+
*/
|
|
341
|
+
buildXOAuth2Token(accessToken) {
|
|
342
|
+
let authData = ['user=' + (this.options.user || ''), 'auth=Bearer ' + (accessToken || this.accessToken), '', ''];
|
|
343
|
+
return Buffer.from(authData.join('\x01'), 'utf-8').toString('base64');
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Custom POST request handler.
|
|
348
|
+
* This is only needed to keep paths short in Windows – usually this module
|
|
349
|
+
* is a dependency of a dependency and if it tries to require something
|
|
350
|
+
* like the request module the paths get way too long to handle for Windows.
|
|
351
|
+
* As we do only a simple POST request we do not actually require complicated
|
|
352
|
+
* logic support (no redirects, no nothing) anyway.
|
|
353
|
+
*
|
|
354
|
+
* @param {String} url Url to POST to
|
|
355
|
+
* @param {String|Buffer} payload Payload to POST
|
|
356
|
+
* @param {Function} callback Callback function with (err, buff)
|
|
357
|
+
*/
|
|
358
|
+
postRequest(url, payload, params, callback) {
|
|
359
|
+
let returned = false;
|
|
360
|
+
|
|
361
|
+
let chunks = [];
|
|
362
|
+
let chunklen = 0;
|
|
363
|
+
|
|
364
|
+
let req = nmfetch(url, {
|
|
365
|
+
method: 'post',
|
|
366
|
+
headers: params.customHeaders,
|
|
367
|
+
body: payload,
|
|
368
|
+
allowErrorResponse: true
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
req.on('readable', () => {
|
|
372
|
+
let chunk;
|
|
373
|
+
while ((chunk = req.read()) !== null) {
|
|
374
|
+
chunks.push(chunk);
|
|
375
|
+
chunklen += chunk.length;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
req.once('error', err => {
|
|
380
|
+
if (returned) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
returned = true;
|
|
384
|
+
return callback(err);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
req.once('end', () => {
|
|
388
|
+
if (returned) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
returned = true;
|
|
392
|
+
return callback(null, Buffer.concat(chunks, chunklen));
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Encodes a buffer or a string into Base64url format
|
|
398
|
+
*
|
|
399
|
+
* @param {Buffer|String} data The data to convert
|
|
400
|
+
* @return {String} The encoded string
|
|
401
|
+
*/
|
|
402
|
+
toBase64URL(data) {
|
|
403
|
+
if (typeof data === 'string') {
|
|
404
|
+
data = Buffer.from(data);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return data
|
|
408
|
+
.toString('base64')
|
|
409
|
+
.replace(/[=]+/g, '') // remove '='s
|
|
410
|
+
.replace(/\+/g, '-') // '+' → '-'
|
|
411
|
+
.replace(/\//g, '_'); // '/' → '_'
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Creates a JSON Web Token signed with RS256 (SHA256 + RSA)
|
|
416
|
+
*
|
|
417
|
+
* @param {Object} payload The payload to include in the generated token
|
|
418
|
+
* @return {String} The generated and signed token
|
|
419
|
+
*/
|
|
420
|
+
jwtSignRS256(payload) {
|
|
421
|
+
payload = ['{"alg":"RS256","typ":"JWT"}', JSON.stringify(payload)].map(val => this.toBase64URL(val)).join('.');
|
|
422
|
+
let signature = crypto.createSign('RSA-SHA256').update(payload).sign(this.options.privateKey);
|
|
423
|
+
return payload + '.' + this.toBase64URL(signature);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
module.exports = XOAuth2;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nodemailer",
|
|
3
|
+
"version": "7.0.13",
|
|
4
|
+
"description": "Easy as cake e-mail sending from your Node.js applications",
|
|
5
|
+
"main": "lib/nodemailer.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js",
|
|
8
|
+
"test:coverage": "c8 node --test --test-concurrency=1 test/**/*.test.js test/**/*-test.js",
|
|
9
|
+
"format": "prettier --write \"**/*.{js,json,md}\"",
|
|
10
|
+
"format:check": "prettier --check \"**/*.{js,json,md}\"",
|
|
11
|
+
"lint": "eslint .",
|
|
12
|
+
"lint:fix": "eslint . --fix",
|
|
13
|
+
"update": "rm -rf node_modules/ package-lock.json && ncu -u && npm install"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/nodemailer/nodemailer.git"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"Nodemailer"
|
|
21
|
+
],
|
|
22
|
+
"author": "Andris Reinman",
|
|
23
|
+
"license": "MIT-0",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/nodemailer/nodemailer/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://nodemailer.com/",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@aws-sdk/client-sesv2": "3.975.0",
|
|
30
|
+
"bunyan": "1.8.15",
|
|
31
|
+
"c8": "10.1.3",
|
|
32
|
+
"eslint": "9.39.2",
|
|
33
|
+
"eslint-config-prettier": "10.1.8",
|
|
34
|
+
"globals": "17.1.0",
|
|
35
|
+
"libbase64": "1.3.0",
|
|
36
|
+
"libmime": "5.3.7",
|
|
37
|
+
"libqp": "2.1.1",
|
|
38
|
+
"nodemailer-ntlm-auth": "1.0.4",
|
|
39
|
+
"prettier": "3.8.1",
|
|
40
|
+
"proxy": "1.0.2",
|
|
41
|
+
"proxy-test-server": "1.0.0",
|
|
42
|
+
"smtp-server": "3.18.0"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=6.0.0"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bobfrankston/mailx-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@bobfrankston/mailx-types": "file:../mailx-types",
|
|
13
|
+
"@bobfrankston/mailx-store": "file:../mailx-store",
|
|
14
|
+
"@bobfrankston/mailx-imap": "file:../mailx-imap",
|
|
15
|
+
"@bobfrankston/mailx-settings": "file:../mailx-settings",
|
|
16
|
+
"express": "^4.21.0",
|
|
17
|
+
"mailparser": "^3.7.2",
|
|
18
|
+
"nodemailer": "^7.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/express": "^5.0.0",
|
|
22
|
+
"@types/nodemailer": "^6.4.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./index.ts"],"version":"5.9.2"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @bobfrankston/mailx-compose
|
|
3
|
+
* Compose message logic — builds prefilled compose data for reply/forward.
|
|
4
|
+
* UI lives in client/compose/; this package has the shared logic.
|
|
5
|
+
*/
|
|
6
|
+
import type { Message, EmailAddress } from "@bobfrankston/mailx-types";
|
|
7
|
+
export type ComposeMode = "new" | "reply" | "replyAll" | "forward";
|
|
8
|
+
/** Data passed to the compose window via query params or postMessage */
|
|
9
|
+
export interface ComposeInit {
|
|
10
|
+
mode: ComposeMode;
|
|
11
|
+
accountId: string;
|
|
12
|
+
to: EmailAddress[];
|
|
13
|
+
cc: EmailAddress[];
|
|
14
|
+
subject: string;
|
|
15
|
+
bodyHtml: string;
|
|
16
|
+
inReplyTo: string;
|
|
17
|
+
references: string[];
|
|
18
|
+
}
|
|
19
|
+
/** Build compose init data from an original message and mode */
|
|
20
|
+
export declare function buildComposeInit(mode: ComposeMode, accountId: string, original?: Message): ComposeInit;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @bobfrankston/mailx-compose
|
|
3
|
+
* Compose message logic — builds prefilled compose data for reply/forward.
|
|
4
|
+
* UI lives in client/compose/; this package has the shared logic.
|
|
5
|
+
*/
|
|
6
|
+
/** Build compose init data from an original message and mode */
|
|
7
|
+
export function buildComposeInit(mode, accountId, original) {
|
|
8
|
+
const init = {
|
|
9
|
+
mode,
|
|
10
|
+
accountId,
|
|
11
|
+
to: [],
|
|
12
|
+
cc: [],
|
|
13
|
+
subject: "",
|
|
14
|
+
bodyHtml: "",
|
|
15
|
+
inReplyTo: "",
|
|
16
|
+
references: [],
|
|
17
|
+
};
|
|
18
|
+
if (!original)
|
|
19
|
+
return init;
|
|
20
|
+
const rePrefix = /^(re|fwd?):\s*/i;
|
|
21
|
+
const cleanSubject = original.subject.replace(rePrefix, "");
|
|
22
|
+
switch (mode) {
|
|
23
|
+
case "reply":
|
|
24
|
+
init.to = [original.from];
|
|
25
|
+
init.subject = `Re: ${cleanSubject}`;
|
|
26
|
+
init.bodyHtml = quoteBody(original);
|
|
27
|
+
init.inReplyTo = original.messageId;
|
|
28
|
+
init.references = [...original.references, original.messageId];
|
|
29
|
+
break;
|
|
30
|
+
case "replyAll":
|
|
31
|
+
init.to = [original.from, ...original.to.filter(a => a.address !== original.from.address)];
|
|
32
|
+
init.cc = original.cc || [];
|
|
33
|
+
init.subject = `Re: ${cleanSubject}`;
|
|
34
|
+
init.bodyHtml = quoteBody(original);
|
|
35
|
+
init.inReplyTo = original.messageId;
|
|
36
|
+
init.references = [...original.references, original.messageId];
|
|
37
|
+
break;
|
|
38
|
+
case "forward":
|
|
39
|
+
init.subject = `Fwd: ${cleanSubject}`;
|
|
40
|
+
init.bodyHtml = forwardBody(original);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return init;
|
|
44
|
+
}
|
|
45
|
+
function quoteBody(msg) {
|
|
46
|
+
const date = new Date(msg.date).toLocaleString();
|
|
47
|
+
const from = msg.from.name ? `${msg.from.name} <${msg.from.address}>` : msg.from.address;
|
|
48
|
+
const body = msg.bodyHtml || `<pre>${escapeHtml(msg.bodyText)}</pre>`;
|
|
49
|
+
return `<br><div class="reply"><p>On ${date}, ${escapeHtml(from)} wrote:</p><blockquote>${body}</blockquote></div>`;
|
|
50
|
+
}
|
|
51
|
+
function forwardBody(msg) {
|
|
52
|
+
const date = new Date(msg.date).toLocaleString();
|
|
53
|
+
const from = msg.from.name ? `${msg.from.name} <${msg.from.address}>` : msg.from.address;
|
|
54
|
+
const to = msg.to.map(a => a.name ? `${a.name} <${a.address}>` : a.address).join(", ");
|
|
55
|
+
const body = msg.bodyHtml || `<pre>${escapeHtml(msg.bodyText)}</pre>`;
|
|
56
|
+
return `<br><div class="reply"><p>---------- Forwarded message ----------<br>From: ${escapeHtml(from)}<br>Date: ${date}<br>Subject: ${escapeHtml(msg.subject)}<br>To: ${escapeHtml(to)}</p>${body}</div>`;
|
|
57
|
+
}
|
|
58
|
+
function escapeHtml(s) {
|
|
59
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bobfrankston/mailx-compose",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@bobfrankston/mailx-types": "file:../mailx-types"
|
|
13
|
+
}
|
|
14
|
+
}
|