@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,629 @@
|
|
|
1
|
+
/* eslint no-undefined: 0 */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const MimeNode = require('../mime-node');
|
|
6
|
+
const mimeFuncs = require('../mime-funcs');
|
|
7
|
+
const parseDataURI = require('../shared').parseDataURI;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates the object for composing a MimeNode instance out from the mail options
|
|
11
|
+
*
|
|
12
|
+
* @constructor
|
|
13
|
+
* @param {Object} mail Mail options
|
|
14
|
+
*/
|
|
15
|
+
class MailComposer {
|
|
16
|
+
constructor(mail) {
|
|
17
|
+
this.mail = mail || {};
|
|
18
|
+
this.message = false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Builds MimeNode instance
|
|
23
|
+
*/
|
|
24
|
+
compile() {
|
|
25
|
+
this._alternatives = this.getAlternatives();
|
|
26
|
+
this._htmlNode = this._alternatives.filter(alternative => /^text\/html\b/i.test(alternative.contentType)).pop();
|
|
27
|
+
this._attachments = this.getAttachments(!!this._htmlNode);
|
|
28
|
+
|
|
29
|
+
this._useRelated = !!(this._htmlNode && this._attachments.related.length);
|
|
30
|
+
this._useAlternative = this._alternatives.length > 1;
|
|
31
|
+
this._useMixed = this._attachments.attached.length > 1 || (this._alternatives.length && this._attachments.attached.length === 1);
|
|
32
|
+
|
|
33
|
+
// Compose MIME tree
|
|
34
|
+
if (this.mail.raw) {
|
|
35
|
+
this.message = new MimeNode('message/rfc822', { newline: this.mail.newline }).setRaw(this.mail.raw);
|
|
36
|
+
} else if (this._useMixed) {
|
|
37
|
+
this.message = this._createMixed();
|
|
38
|
+
} else if (this._useAlternative) {
|
|
39
|
+
this.message = this._createAlternative();
|
|
40
|
+
} else if (this._useRelated) {
|
|
41
|
+
this.message = this._createRelated();
|
|
42
|
+
} else {
|
|
43
|
+
this.message = this._createContentNode(
|
|
44
|
+
false,
|
|
45
|
+
[]
|
|
46
|
+
.concat(this._alternatives || [])
|
|
47
|
+
.concat(this._attachments.attached || [])
|
|
48
|
+
.shift() || {
|
|
49
|
+
contentType: 'text/plain',
|
|
50
|
+
content: ''
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Add custom headers
|
|
56
|
+
if (this.mail.headers) {
|
|
57
|
+
this.message.addHeader(this.mail.headers);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Add headers to the root node, always overrides custom headers
|
|
61
|
+
['from', 'sender', 'to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'message-id', 'date'].forEach(header => {
|
|
62
|
+
let key = header.replace(/-(\w)/g, (o, c) => c.toUpperCase());
|
|
63
|
+
if (this.mail[key]) {
|
|
64
|
+
this.message.setHeader(header, this.mail[key]);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Sets custom envelope
|
|
69
|
+
if (this.mail.envelope) {
|
|
70
|
+
this.message.setEnvelope(this.mail.envelope);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ensure Message-Id value
|
|
74
|
+
this.message.messageId();
|
|
75
|
+
|
|
76
|
+
return this.message;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* List all attachments. Resulting attachment objects can be used as input for MimeNode nodes
|
|
81
|
+
*
|
|
82
|
+
* @param {Boolean} findRelated If true separate related attachments from attached ones
|
|
83
|
+
* @returns {Object} An object of arrays (`related` and `attached`)
|
|
84
|
+
*/
|
|
85
|
+
getAttachments(findRelated) {
|
|
86
|
+
let icalEvent, eventObject;
|
|
87
|
+
let attachments = [].concat(this.mail.attachments || []).map((attachment, i) => {
|
|
88
|
+
let data;
|
|
89
|
+
|
|
90
|
+
if (/^data:/i.test(attachment.path || attachment.href)) {
|
|
91
|
+
attachment = this._processDataUrl(attachment);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let contentType =
|
|
95
|
+
attachment.contentType || mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin');
|
|
96
|
+
|
|
97
|
+
let isImage = /^image\//i.test(contentType);
|
|
98
|
+
let isMessageNode = /^message\//i.test(contentType);
|
|
99
|
+
|
|
100
|
+
let contentDisposition =
|
|
101
|
+
attachment.contentDisposition || (isMessageNode || (isImage && attachment.cid) ? 'inline' : 'attachment');
|
|
102
|
+
|
|
103
|
+
let contentTransferEncoding;
|
|
104
|
+
if ('contentTransferEncoding' in attachment) {
|
|
105
|
+
// also contains `false`, to set
|
|
106
|
+
contentTransferEncoding = attachment.contentTransferEncoding;
|
|
107
|
+
} else if (isMessageNode) {
|
|
108
|
+
// the content might include non-ASCII bytes but at this point we do not know it yet
|
|
109
|
+
contentTransferEncoding = '8bit';
|
|
110
|
+
} else {
|
|
111
|
+
contentTransferEncoding = 'base64'; // the default
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
data = {
|
|
115
|
+
contentType,
|
|
116
|
+
contentDisposition,
|
|
117
|
+
contentTransferEncoding
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
if (attachment.filename) {
|
|
121
|
+
data.filename = attachment.filename;
|
|
122
|
+
} else if (!isMessageNode && attachment.filename !== false) {
|
|
123
|
+
data.filename = (attachment.path || attachment.href || '').split('/').pop().split('?').shift() || 'attachment-' + (i + 1);
|
|
124
|
+
if (data.filename.indexOf('.') < 0) {
|
|
125
|
+
data.filename += '.' + mimeFuncs.detectExtension(data.contentType);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (/^https?:\/\//i.test(attachment.path)) {
|
|
130
|
+
attachment.href = attachment.path;
|
|
131
|
+
attachment.path = undefined;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (attachment.cid) {
|
|
135
|
+
data.cid = attachment.cid;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (attachment.raw) {
|
|
139
|
+
data.raw = attachment.raw;
|
|
140
|
+
} else if (attachment.path) {
|
|
141
|
+
data.content = {
|
|
142
|
+
path: attachment.path
|
|
143
|
+
};
|
|
144
|
+
} else if (attachment.href) {
|
|
145
|
+
data.content = {
|
|
146
|
+
href: attachment.href,
|
|
147
|
+
httpHeaders: attachment.httpHeaders
|
|
148
|
+
};
|
|
149
|
+
} else {
|
|
150
|
+
data.content = attachment.content || '';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (attachment.encoding) {
|
|
154
|
+
data.encoding = attachment.encoding;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (attachment.headers) {
|
|
158
|
+
data.headers = attachment.headers;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return data;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (this.mail.icalEvent) {
|
|
165
|
+
if (
|
|
166
|
+
typeof this.mail.icalEvent === 'object' &&
|
|
167
|
+
(this.mail.icalEvent.content || this.mail.icalEvent.path || this.mail.icalEvent.href || this.mail.icalEvent.raw)
|
|
168
|
+
) {
|
|
169
|
+
icalEvent = this.mail.icalEvent;
|
|
170
|
+
} else {
|
|
171
|
+
icalEvent = {
|
|
172
|
+
content: this.mail.icalEvent
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
eventObject = {};
|
|
177
|
+
Object.keys(icalEvent).forEach(key => {
|
|
178
|
+
eventObject[key] = icalEvent[key];
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
eventObject.contentType = 'application/ics';
|
|
182
|
+
if (!eventObject.headers) {
|
|
183
|
+
eventObject.headers = {};
|
|
184
|
+
}
|
|
185
|
+
eventObject.filename = eventObject.filename || 'invite.ics';
|
|
186
|
+
eventObject.headers['Content-Disposition'] = 'attachment';
|
|
187
|
+
eventObject.headers['Content-Transfer-Encoding'] = 'base64';
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (!findRelated) {
|
|
191
|
+
return {
|
|
192
|
+
attached: attachments.concat(eventObject || []),
|
|
193
|
+
related: []
|
|
194
|
+
};
|
|
195
|
+
} else {
|
|
196
|
+
return {
|
|
197
|
+
attached: attachments.filter(attachment => !attachment.cid).concat(eventObject || []),
|
|
198
|
+
related: attachments.filter(attachment => !!attachment.cid)
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* List alternatives. Resulting objects can be used as input for MimeNode nodes
|
|
205
|
+
*
|
|
206
|
+
* @returns {Array} An array of alternative elements. Includes the `text` and `html` values as well
|
|
207
|
+
*/
|
|
208
|
+
getAlternatives() {
|
|
209
|
+
let alternatives = [],
|
|
210
|
+
text,
|
|
211
|
+
html,
|
|
212
|
+
watchHtml,
|
|
213
|
+
amp,
|
|
214
|
+
icalEvent,
|
|
215
|
+
eventObject;
|
|
216
|
+
|
|
217
|
+
if (this.mail.text) {
|
|
218
|
+
if (
|
|
219
|
+
typeof this.mail.text === 'object' &&
|
|
220
|
+
(this.mail.text.content || this.mail.text.path || this.mail.text.href || this.mail.text.raw)
|
|
221
|
+
) {
|
|
222
|
+
text = this.mail.text;
|
|
223
|
+
} else {
|
|
224
|
+
text = {
|
|
225
|
+
content: this.mail.text
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
text.contentType = 'text/plain; charset=utf-8';
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (this.mail.watchHtml) {
|
|
232
|
+
if (
|
|
233
|
+
typeof this.mail.watchHtml === 'object' &&
|
|
234
|
+
(this.mail.watchHtml.content || this.mail.watchHtml.path || this.mail.watchHtml.href || this.mail.watchHtml.raw)
|
|
235
|
+
) {
|
|
236
|
+
watchHtml = this.mail.watchHtml;
|
|
237
|
+
} else {
|
|
238
|
+
watchHtml = {
|
|
239
|
+
content: this.mail.watchHtml
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
watchHtml.contentType = 'text/watch-html; charset=utf-8';
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (this.mail.amp) {
|
|
246
|
+
if (
|
|
247
|
+
typeof this.mail.amp === 'object' &&
|
|
248
|
+
(this.mail.amp.content || this.mail.amp.path || this.mail.amp.href || this.mail.amp.raw)
|
|
249
|
+
) {
|
|
250
|
+
amp = this.mail.amp;
|
|
251
|
+
} else {
|
|
252
|
+
amp = {
|
|
253
|
+
content: this.mail.amp
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
amp.contentType = 'text/x-amp-html; charset=utf-8';
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// NB! when including attachments with a calendar alternative you might end up in a blank screen on some clients
|
|
260
|
+
if (this.mail.icalEvent) {
|
|
261
|
+
if (
|
|
262
|
+
typeof this.mail.icalEvent === 'object' &&
|
|
263
|
+
(this.mail.icalEvent.content || this.mail.icalEvent.path || this.mail.icalEvent.href || this.mail.icalEvent.raw)
|
|
264
|
+
) {
|
|
265
|
+
icalEvent = this.mail.icalEvent;
|
|
266
|
+
} else {
|
|
267
|
+
icalEvent = {
|
|
268
|
+
content: this.mail.icalEvent
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
eventObject = {};
|
|
273
|
+
Object.keys(icalEvent).forEach(key => {
|
|
274
|
+
eventObject[key] = icalEvent[key];
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
if (eventObject.content && typeof eventObject.content === 'object') {
|
|
278
|
+
// we are going to have the same attachment twice, so mark this to be
|
|
279
|
+
// resolved just once
|
|
280
|
+
eventObject.content._resolve = true;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
eventObject.filename = false;
|
|
284
|
+
eventObject.contentType =
|
|
285
|
+
'text/calendar; charset=utf-8; method=' + (eventObject.method || 'PUBLISH').toString().trim().toUpperCase();
|
|
286
|
+
if (!eventObject.headers) {
|
|
287
|
+
eventObject.headers = {};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (this.mail.html) {
|
|
292
|
+
if (
|
|
293
|
+
typeof this.mail.html === 'object' &&
|
|
294
|
+
(this.mail.html.content || this.mail.html.path || this.mail.html.href || this.mail.html.raw)
|
|
295
|
+
) {
|
|
296
|
+
html = this.mail.html;
|
|
297
|
+
} else {
|
|
298
|
+
html = {
|
|
299
|
+
content: this.mail.html
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
html.contentType = 'text/html; charset=utf-8';
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
[]
|
|
306
|
+
.concat(text || [])
|
|
307
|
+
.concat(watchHtml || [])
|
|
308
|
+
.concat(amp || [])
|
|
309
|
+
.concat(html || [])
|
|
310
|
+
.concat(eventObject || [])
|
|
311
|
+
.concat(this.mail.alternatives || [])
|
|
312
|
+
.forEach(alternative => {
|
|
313
|
+
let data;
|
|
314
|
+
|
|
315
|
+
if (/^data:/i.test(alternative.path || alternative.href)) {
|
|
316
|
+
alternative = this._processDataUrl(alternative);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
data = {
|
|
320
|
+
contentType:
|
|
321
|
+
alternative.contentType ||
|
|
322
|
+
mimeFuncs.detectMimeType(alternative.filename || alternative.path || alternative.href || 'txt'),
|
|
323
|
+
contentTransferEncoding: alternative.contentTransferEncoding
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
if (alternative.filename) {
|
|
327
|
+
data.filename = alternative.filename;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (/^https?:\/\//i.test(alternative.path)) {
|
|
331
|
+
alternative.href = alternative.path;
|
|
332
|
+
alternative.path = undefined;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (alternative.raw) {
|
|
336
|
+
data.raw = alternative.raw;
|
|
337
|
+
} else if (alternative.path) {
|
|
338
|
+
data.content = {
|
|
339
|
+
path: alternative.path
|
|
340
|
+
};
|
|
341
|
+
} else if (alternative.href) {
|
|
342
|
+
data.content = {
|
|
343
|
+
href: alternative.href
|
|
344
|
+
};
|
|
345
|
+
} else {
|
|
346
|
+
data.content = alternative.content || '';
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (alternative.encoding) {
|
|
350
|
+
data.encoding = alternative.encoding;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (alternative.headers) {
|
|
354
|
+
data.headers = alternative.headers;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
alternatives.push(data);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
return alternatives;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Builds multipart/mixed node. It should always contain different type of elements on the same level
|
|
365
|
+
* eg. text + attachments
|
|
366
|
+
*
|
|
367
|
+
* @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
|
|
368
|
+
* @returns {Object} MimeNode node element
|
|
369
|
+
*/
|
|
370
|
+
_createMixed(parentNode) {
|
|
371
|
+
let node;
|
|
372
|
+
|
|
373
|
+
if (!parentNode) {
|
|
374
|
+
node = new MimeNode('multipart/mixed', {
|
|
375
|
+
baseBoundary: this.mail.baseBoundary,
|
|
376
|
+
textEncoding: this.mail.textEncoding,
|
|
377
|
+
boundaryPrefix: this.mail.boundaryPrefix,
|
|
378
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
379
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
380
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
381
|
+
newline: this.mail.newline
|
|
382
|
+
});
|
|
383
|
+
} else {
|
|
384
|
+
node = parentNode.createChild('multipart/mixed', {
|
|
385
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
386
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
387
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
388
|
+
newline: this.mail.newline
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (this._useAlternative) {
|
|
393
|
+
this._createAlternative(node);
|
|
394
|
+
} else if (this._useRelated) {
|
|
395
|
+
this._createRelated(node);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
[]
|
|
399
|
+
.concat((!this._useAlternative && this._alternatives) || [])
|
|
400
|
+
.concat(this._attachments.attached || [])
|
|
401
|
+
.forEach(element => {
|
|
402
|
+
// if the element is a html node from related subpart then ignore it
|
|
403
|
+
if (!this._useRelated || element !== this._htmlNode) {
|
|
404
|
+
this._createContentNode(node, element);
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
return node;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Builds multipart/alternative node. It should always contain same type of elements on the same level
|
|
413
|
+
* eg. text + html view of the same data
|
|
414
|
+
*
|
|
415
|
+
* @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
|
|
416
|
+
* @returns {Object} MimeNode node element
|
|
417
|
+
*/
|
|
418
|
+
_createAlternative(parentNode) {
|
|
419
|
+
let node;
|
|
420
|
+
|
|
421
|
+
if (!parentNode) {
|
|
422
|
+
node = new MimeNode('multipart/alternative', {
|
|
423
|
+
baseBoundary: this.mail.baseBoundary,
|
|
424
|
+
textEncoding: this.mail.textEncoding,
|
|
425
|
+
boundaryPrefix: this.mail.boundaryPrefix,
|
|
426
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
427
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
428
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
429
|
+
newline: this.mail.newline
|
|
430
|
+
});
|
|
431
|
+
} else {
|
|
432
|
+
node = parentNode.createChild('multipart/alternative', {
|
|
433
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
434
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
435
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
436
|
+
newline: this.mail.newline
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
this._alternatives.forEach(alternative => {
|
|
441
|
+
if (this._useRelated && this._htmlNode === alternative) {
|
|
442
|
+
this._createRelated(node);
|
|
443
|
+
} else {
|
|
444
|
+
this._createContentNode(node, alternative);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
return node;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Builds multipart/related node. It should always contain html node with related attachments
|
|
453
|
+
*
|
|
454
|
+
* @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
|
|
455
|
+
* @returns {Object} MimeNode node element
|
|
456
|
+
*/
|
|
457
|
+
_createRelated(parentNode) {
|
|
458
|
+
let node;
|
|
459
|
+
|
|
460
|
+
if (!parentNode) {
|
|
461
|
+
node = new MimeNode('multipart/related; type="text/html"', {
|
|
462
|
+
baseBoundary: this.mail.baseBoundary,
|
|
463
|
+
textEncoding: this.mail.textEncoding,
|
|
464
|
+
boundaryPrefix: this.mail.boundaryPrefix,
|
|
465
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
466
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
467
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
468
|
+
newline: this.mail.newline
|
|
469
|
+
});
|
|
470
|
+
} else {
|
|
471
|
+
node = parentNode.createChild('multipart/related; type="text/html"', {
|
|
472
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
473
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
474
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
475
|
+
newline: this.mail.newline
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
this._createContentNode(node, this._htmlNode);
|
|
480
|
+
|
|
481
|
+
this._attachments.related.forEach(alternative => this._createContentNode(node, alternative));
|
|
482
|
+
|
|
483
|
+
return node;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Creates a regular node with contents
|
|
488
|
+
*
|
|
489
|
+
* @param {Object} parentNode Parent for this note. If it does not exist, a root node is created
|
|
490
|
+
* @param {Object} element Node data
|
|
491
|
+
* @returns {Object} MimeNode node element
|
|
492
|
+
*/
|
|
493
|
+
_createContentNode(parentNode, element) {
|
|
494
|
+
element = element || {};
|
|
495
|
+
element.content = element.content || '';
|
|
496
|
+
|
|
497
|
+
let node;
|
|
498
|
+
let encoding = (element.encoding || 'utf8')
|
|
499
|
+
.toString()
|
|
500
|
+
.toLowerCase()
|
|
501
|
+
.replace(/[-_\s]/g, '');
|
|
502
|
+
|
|
503
|
+
if (!parentNode) {
|
|
504
|
+
node = new MimeNode(element.contentType, {
|
|
505
|
+
filename: element.filename,
|
|
506
|
+
baseBoundary: this.mail.baseBoundary,
|
|
507
|
+
textEncoding: this.mail.textEncoding,
|
|
508
|
+
boundaryPrefix: this.mail.boundaryPrefix,
|
|
509
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
510
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
511
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
512
|
+
newline: this.mail.newline
|
|
513
|
+
});
|
|
514
|
+
} else {
|
|
515
|
+
node = parentNode.createChild(element.contentType, {
|
|
516
|
+
filename: element.filename,
|
|
517
|
+
textEncoding: this.mail.textEncoding,
|
|
518
|
+
disableUrlAccess: this.mail.disableUrlAccess,
|
|
519
|
+
disableFileAccess: this.mail.disableFileAccess,
|
|
520
|
+
normalizeHeaderKey: this.mail.normalizeHeaderKey,
|
|
521
|
+
newline: this.mail.newline
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// add custom headers
|
|
526
|
+
if (element.headers) {
|
|
527
|
+
node.addHeader(element.headers);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (element.cid) {
|
|
531
|
+
node.setHeader('Content-Id', '<' + element.cid.replace(/[<>]/g, '') + '>');
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (element.contentTransferEncoding) {
|
|
535
|
+
node.setHeader('Content-Transfer-Encoding', element.contentTransferEncoding);
|
|
536
|
+
} else if (this.mail.encoding && /^text\//i.test(element.contentType)) {
|
|
537
|
+
node.setHeader('Content-Transfer-Encoding', this.mail.encoding);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (!/^text\//i.test(element.contentType) || element.contentDisposition) {
|
|
541
|
+
node.setHeader(
|
|
542
|
+
'Content-Disposition',
|
|
543
|
+
element.contentDisposition || (element.cid && /^image\//i.test(element.contentType) ? 'inline' : 'attachment')
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
if (typeof element.content === 'string' && !['utf8', 'usascii', 'ascii'].includes(encoding)) {
|
|
548
|
+
element.content = Buffer.from(element.content, encoding);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// prefer pregenerated raw content
|
|
552
|
+
if (element.raw) {
|
|
553
|
+
node.setRaw(element.raw);
|
|
554
|
+
} else {
|
|
555
|
+
node.setContent(element.content);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return node;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Parses data uri and converts it to a Buffer
|
|
563
|
+
*
|
|
564
|
+
* @param {Object} element Content element
|
|
565
|
+
* @return {Object} Parsed element
|
|
566
|
+
*/
|
|
567
|
+
_processDataUrl(element) {
|
|
568
|
+
const dataUrl = element.path || element.href;
|
|
569
|
+
|
|
570
|
+
// Early validation to prevent ReDoS
|
|
571
|
+
if (!dataUrl || typeof dataUrl !== 'string') {
|
|
572
|
+
return element;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (!dataUrl.startsWith('data:')) {
|
|
576
|
+
return element;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (dataUrl.length > 52428800) {
|
|
580
|
+
// 52428800 chars = 50MB limit for data URL string (~37.5MB decoded image)
|
|
581
|
+
// Extract content type before rejecting to preserve MIME type
|
|
582
|
+
let detectedType = 'application/octet-stream';
|
|
583
|
+
const commaPos = dataUrl.indexOf(',');
|
|
584
|
+
|
|
585
|
+
if (commaPos > 0 && commaPos < 200) {
|
|
586
|
+
// Parse header safely with size limit
|
|
587
|
+
const header = dataUrl.substring(5, commaPos); // skip 'data:'
|
|
588
|
+
const parts = header.split(';');
|
|
589
|
+
if (parts[0] && parts[0].includes('/')) {
|
|
590
|
+
detectedType = parts[0].trim();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// Return empty content for excessively long data URLs
|
|
595
|
+
return Object.assign({}, element, {
|
|
596
|
+
path: false,
|
|
597
|
+
href: false,
|
|
598
|
+
content: Buffer.alloc(0),
|
|
599
|
+
contentType: element.contentType || detectedType
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
let parsedDataUri;
|
|
604
|
+
try {
|
|
605
|
+
parsedDataUri = parseDataURI(dataUrl);
|
|
606
|
+
} catch (_err) {
|
|
607
|
+
return element;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (!parsedDataUri) {
|
|
611
|
+
return element;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
element.content = parsedDataUri.data;
|
|
615
|
+
element.contentType = element.contentType || parsedDataUri.contentType;
|
|
616
|
+
|
|
617
|
+
if ('path' in element) {
|
|
618
|
+
element.path = false;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if ('href' in element) {
|
|
622
|
+
element.href = false;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
return element;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
module.exports = MailComposer;
|