@masonjames/emdash-smtp-node-transports 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mason James
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ import { DeliveryMessage, LocalRuntimeTransportConfig, SmtpRuntimeTransportConfig } from "@masonjames/emdash-smtp-core";
2
+
3
+ //#region src/index.d.ts
4
+ declare function smtpSend(config: SmtpRuntimeTransportConfig, message: DeliveryMessage): Promise<{
5
+ remoteMessageId?: string;
6
+ }>;
7
+ declare function sendmailSend(config: LocalRuntimeTransportConfig, message: DeliveryMessage): Promise<{
8
+ remoteMessageId?: string;
9
+ }>;
10
+ //#endregion
11
+ export { sendmailSend, smtpSend };
12
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;iBAesB,QAAA,CACrB,MAAA,EAAQ,0BAAA,EACR,OAAA,EAAS,eAAA,GACP,OAAA;EAAU,eAAA;AAAA;AAAA,iBA0BS,YAAA,CACrB,MAAA,EAAQ,2BAAA,EACR,OAAA,EAAS,eAAA,GACP,OAAA;EAAU,eAAA;AAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,43 @@
1
+ import nodemailer from "nodemailer";
2
+
3
+ //#region src/index.ts
4
+ function formatSender(message) {
5
+ if (!message.fromEmail) throw new Error("A sender email is required for trusted delivery transports.");
6
+ return message.fromName ? `${message.fromName} <${message.fromEmail}>` : message.fromEmail;
7
+ }
8
+ async function smtpSend(config, message) {
9
+ return { remoteMessageId: (await nodemailer.createTransport({
10
+ host: config.host,
11
+ port: config.port,
12
+ secure: config.secure,
13
+ auth: config.username || config.password ? {
14
+ user: config.username,
15
+ pass: config.password
16
+ } : void 0
17
+ }).sendMail({
18
+ from: formatSender(message),
19
+ to: message.to.join(", "),
20
+ subject: message.subject,
21
+ text: message.text,
22
+ html: message.html,
23
+ replyTo: message.replyTo?.join(", ")
24
+ })).messageId };
25
+ }
26
+ async function sendmailSend(config, message) {
27
+ return { remoteMessageId: (await nodemailer.createTransport({
28
+ sendmail: true,
29
+ newline: "unix",
30
+ path: config.sendmailPath || "sendmail"
31
+ }).sendMail({
32
+ from: config.fromName ? `${config.fromName} <${config.fromEmail}>` : config.fromEmail,
33
+ to: message.to.join(", "),
34
+ subject: message.subject,
35
+ text: message.text,
36
+ html: message.html,
37
+ replyTo: message.replyTo?.join(", ")
38
+ })).messageId };
39
+ }
40
+
41
+ //#endregion
42
+ export { sendmailSend, smtpSend };
43
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import nodemailer from \"nodemailer\";\n\nimport type {\n\tDeliveryMessage,\n\tLocalRuntimeTransportConfig,\n\tSmtpRuntimeTransportConfig,\n} from \"@masonjames/emdash-smtp-core\";\n\nfunction formatSender(message: DeliveryMessage): string {\n\tif (!message.fromEmail) {\n\t\tthrow new Error(\"A sender email is required for trusted delivery transports.\");\n\t}\n\treturn message.fromName ? `${message.fromName} <${message.fromEmail}>` : message.fromEmail;\n}\n\nexport async function smtpSend(\n\tconfig: SmtpRuntimeTransportConfig,\n\tmessage: DeliveryMessage,\n): Promise<{ remoteMessageId?: string }> {\n\tconst transporter = nodemailer.createTransport({\n\t\thost: config.host,\n\t\tport: config.port,\n\t\tsecure: config.secure,\n\t\tauth:\n\t\t\tconfig.username || config.password\n\t\t\t\t? {\n\t\t\t\t\t\tuser: config.username,\n\t\t\t\t\t\tpass: config.password,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t});\n\n\tconst result = await transporter.sendMail({\n\t\tfrom: formatSender(message),\n\t\tto: message.to.join(\", \"),\n\t\tsubject: message.subject,\n\t\ttext: message.text,\n\t\thtml: message.html,\n\t\treplyTo: message.replyTo?.join(\", \"),\n\t});\n\n\treturn { remoteMessageId: result.messageId };\n}\n\nexport async function sendmailSend(\n\tconfig: LocalRuntimeTransportConfig,\n\tmessage: DeliveryMessage,\n): Promise<{ remoteMessageId?: string }> {\n\tconst transporter = nodemailer.createTransport({\n\t\tsendmail: true,\n\t\tnewline: \"unix\",\n\t\tpath: config.sendmailPath || \"sendmail\",\n\t});\n\n\tconst result = await transporter.sendMail({\n\t\tfrom: config.fromName ? `${config.fromName} <${config.fromEmail}>` : config.fromEmail,\n\t\tto: message.to.join(\", \"),\n\t\tsubject: message.subject,\n\t\ttext: message.text,\n\t\thtml: message.html,\n\t\treplyTo: message.replyTo?.join(\", \"),\n\t});\n\n\treturn { remoteMessageId: result.messageId };\n}\n"],"mappings":";;;AAQA,SAAS,aAAa,SAAkC;AACvD,KAAI,CAAC,QAAQ,UACZ,OAAM,IAAI,MAAM,8DAA8D;AAE/E,QAAO,QAAQ,WAAW,GAAG,QAAQ,SAAS,IAAI,QAAQ,UAAU,KAAK,QAAQ;;AAGlF,eAAsB,SACrB,QACA,SACwC;AAuBxC,QAAO,EAAE,kBATM,MAbK,WAAW,gBAAgB;EAC9C,MAAM,OAAO;EACb,MAAM,OAAO;EACb,QAAQ,OAAO;EACf,MACC,OAAO,YAAY,OAAO,WACvB;GACA,MAAM,OAAO;GACb,MAAM,OAAO;GACb,GACA;EACJ,CAAC,CAE+B,SAAS;EACzC,MAAM,aAAa,QAAQ;EAC3B,IAAI,QAAQ,GAAG,KAAK,KAAK;EACzB,SAAS,QAAQ;EACjB,MAAM,QAAQ;EACd,MAAM,QAAQ;EACd,SAAS,QAAQ,SAAS,KAAK,KAAK;EACpC,CAAC,EAE+B,WAAW;;AAG7C,eAAsB,aACrB,QACA,SACwC;AAgBxC,QAAO,EAAE,kBATM,MANK,WAAW,gBAAgB;EAC9C,UAAU;EACV,SAAS;EACT,MAAM,OAAO,gBAAgB;EAC7B,CAAC,CAE+B,SAAS;EACzC,MAAM,OAAO,WAAW,GAAG,OAAO,SAAS,IAAI,OAAO,UAAU,KAAK,OAAO;EAC5E,IAAI,QAAQ,GAAG,KAAK,KAAK;EACzB,SAAS,QAAQ;EACjB,MAAM,QAAQ;EACd,MAAM,QAAQ;EACd,SAAS,QAAQ,SAAS,KAAK,KAAK;EACpC,CAAC,EAE+B,WAAW"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@masonjames/emdash-smtp-node-transports",
3
+ "version": "0.1.0",
4
+ "description": "Trusted-only SMTP and sendmail transport adapters for EmDash SMTP",
5
+ "type": "module",
6
+ "main": "dist/index.mjs",
7
+ "types": "dist/index.d.mts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "types": "./dist/index.d.mts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "keywords": [
18
+ "emdash",
19
+ "emdash-plugin",
20
+ "smtp",
21
+ "email",
22
+ "nodemailer"
23
+ ],
24
+ "author": "Mason James",
25
+ "dependencies": {
26
+ "@masonjames/emdash-smtp-core": "0.1.0",
27
+ "nodemailer": "^6.10.1"
28
+ },
29
+ "license": "MIT",
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/masonjames/emdash-smtp.git",
36
+ "directory": "packages/node-transports"
37
+ },
38
+ "homepage": "https://github.com/masonjames/emdash-smtp#readme",
39
+ "bugs": {
40
+ "url": "https://github.com/masonjames/emdash-smtp/issues"
41
+ },
42
+ "scripts": {
43
+ "build": "tsdown src/index.ts --format esm --dts --clean",
44
+ "test": "vitest run",
45
+ "typecheck": "tsc --noEmit -p tsconfig.json"
46
+ }
47
+ }