@molecule/api-emails-sendmail 1.0.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 +115 -0
- package/dist/browser-guard.d.ts +2 -0
- package/dist/browser-guard.d.ts.map +1 -0
- package/dist/browser-guard.js +19 -0
- package/dist/browser-guard.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/provider.d.ts +11 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +13 -0
- package/dist/provider.js.map +1 -0
- package/dist/sendMail.d.ts +14 -0
- package/dist/sendMail.d.ts.map +1 -0
- package/dist/sendMail.js +37 -0
- package/dist/sendMail.js.map +1 -0
- package/dist/transport.d.ts +30 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +34 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the
|
|
45
|
+
original version of the Work and any modifications or additions
|
|
46
|
+
to that Work, that is intentionally submitted to the Licensor for
|
|
47
|
+
inclusion in the Work by the copyright owner or by an individual or
|
|
48
|
+
Legal Entity authorized to submit on behalf of the copyright owner.
|
|
49
|
+
|
|
50
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
52
|
+
subsequently incorporated within the Work.
|
|
53
|
+
|
|
54
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
55
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
56
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
57
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
58
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
59
|
+
Work and such Derivative Works in Source or Object form.
|
|
60
|
+
|
|
61
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
63
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
+
patent license to make, have made, use, offer to sell, sell, import,
|
|
65
|
+
and otherwise transfer the Work.
|
|
66
|
+
|
|
67
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
69
|
+
modifications, and in Source or Object form, provided that You
|
|
70
|
+
meet the following conditions:
|
|
71
|
+
|
|
72
|
+
(a) You must give any other recipients of the Work or
|
|
73
|
+
Derivative Works a copy of this License; and
|
|
74
|
+
|
|
75
|
+
(b) You must cause any modified files to carry prominent notices
|
|
76
|
+
stating that You changed the files; and
|
|
77
|
+
|
|
78
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
79
|
+
that You distribute, all copyright, patent, trademark, and
|
|
80
|
+
attribution notices from the Source form of the Work,
|
|
81
|
+
excluding those notices that do not pertain to any part of
|
|
82
|
+
the Derivative Works; and
|
|
83
|
+
|
|
84
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
|
+
distribution, then any Derivative Works that You distribute must
|
|
86
|
+
include a readable copy of the attribution notices contained
|
|
87
|
+
within such NOTICE file.
|
|
88
|
+
|
|
89
|
+
5. Submission of Contributions.
|
|
90
|
+
|
|
91
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
93
|
+
|
|
94
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
+
agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
96
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
97
|
+
|
|
98
|
+
8. Limitation of Liability. In no event and under no legal theory shall
|
|
99
|
+
any Contributor be liable to You for damages.
|
|
100
|
+
|
|
101
|
+
9. Accepting Warranty or Additional Liability.
|
|
102
|
+
|
|
103
|
+
Copyright 2026 Molecule Dev, Inc.
|
|
104
|
+
|
|
105
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
you may not use this file except in compliance with the License.
|
|
107
|
+
You may obtain a copy of the License at
|
|
108
|
+
|
|
109
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
|
|
111
|
+
Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
See the License for the specific language governing permissions and
|
|
115
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-guard.d.ts","sourceRoot":"","sources":["../src/browser-guard.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser guard — `@molecule/api-emails-sendmail` is SERVER-ONLY.
|
|
3
|
+
*
|
|
4
|
+
* Generated by scripts/gen-browser-guards.mjs (workspace root) — edit THAT, not this.
|
|
5
|
+
* Evaluating a server package in a browser bundle is always an import-graph mistake
|
|
6
|
+
* (node APIs, secrets); without this guard it surfaces as a cryptic downstream crash
|
|
7
|
+
* ("Buffer is not defined") far from the culprit. Throwing here names the package and
|
|
8
|
+
* the fix at the exact moment the client bundle evaluates it. jsdom tests and SSR are
|
|
9
|
+
* unaffected: the throw requires browser globals AND the absence of a node runtime.
|
|
10
|
+
*/
|
|
11
|
+
const g = globalThis;
|
|
12
|
+
if (g.window !== undefined && g.document !== undefined && !g.process?.versions?.node) {
|
|
13
|
+
throw new Error('@molecule/api-emails-sendmail is SERVER-ONLY: it was bundled into browser/client code. Import it only ' +
|
|
14
|
+
'from server code (a server route/function or your API), or dynamic-import it inside ' +
|
|
15
|
+
'the server handler — never from components or shared client modules, and never ' +
|
|
16
|
+
'polyfill Buffer/process to silence this.');
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=browser-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-guard.js","sourceRoot":"","sources":["../src/browser-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,GAAG,UAIT,CAAA;AACD,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACrF,MAAM,IAAI,KAAK,CACb,wGAAwG;QACtG,sFAAsF;QACtF,iFAAiF;QACjF,0CAA0C,CAC7C,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail email provider for molecule.dev.
|
|
3
|
+
*
|
|
4
|
+
* Uses the local sendmail command to send emails.
|
|
5
|
+
*
|
|
6
|
+
* Note: For this to work, your server must have `sendmail` installed and
|
|
7
|
+
* configured. The binary path defaults to `/usr/sbin/sendmail`; set the
|
|
8
|
+
* `SENDMAIL_PATH` environment variable to use a different binary (e.g.
|
|
9
|
+
* `/usr/lib/sendmail`, or an msmtp/mhsendmail shim in containers). The path
|
|
10
|
+
* is read once at module load.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* On success, `sendMail()` resolves with `accepted` set to the envelope
|
|
14
|
+
* recipients (sendmail queues the message for all of them once the binary
|
|
15
|
+
* exits 0) and `response: 'Messages queued for delivery'`. Failures reject
|
|
16
|
+
* with distinct errors: a missing binary is a `spawn ... ENOENT` error
|
|
17
|
+
* (install sendmail or set `SENDMAIL_PATH`), a binary that exits non-zero is
|
|
18
|
+
* `Sendmail exited with code <n>`, and an envelope address starting with `-`
|
|
19
|
+
* is rejected up front with `Invalid envelope addresses.` (argument-injection
|
|
20
|
+
* guard) — inspect the message/`code` to tell configuration problems apart
|
|
21
|
+
* from delivery problems.
|
|
22
|
+
*
|
|
23
|
+
* The `accepted`-from-envelope mapping above exists because `@types/nodemailer`
|
|
24
|
+
* declares `accepted`/`rejected`/`pending` on `SendmailTransport.SentMessageInfo`
|
|
25
|
+
* (and `SESTransport.SentMessageInfo`), but nodemailer's actual sendmail (and
|
|
26
|
+
* SES) transports never set them — only the SMTP transports do. Code written
|
|
27
|
+
* against the typings type-checks cleanly and reads `undefined`/`[]` at
|
|
28
|
+
* runtime. If you upgrade `nodemailer` or `@types/nodemailer`, re-verify this
|
|
29
|
+
* against the transport implementations themselves
|
|
30
|
+
* (`lib/sendmail-transport/index.js`), not the shipped `.d.ts` — the typings
|
|
31
|
+
* are exactly what drifted last time.
|
|
32
|
+
*
|
|
33
|
+
* @see https://www.npmjs.com/package/nodemailer
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
export * from './browser-guard.js';
|
|
38
|
+
export * from './provider.js';
|
|
39
|
+
export * from './sendMail.js';
|
|
40
|
+
export * from './transport.js';
|
|
41
|
+
export * from './types.js';
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail email provider for molecule.dev.
|
|
3
|
+
*
|
|
4
|
+
* Uses the local sendmail command to send emails.
|
|
5
|
+
*
|
|
6
|
+
* Note: For this to work, your server must have `sendmail` installed and
|
|
7
|
+
* configured. The binary path defaults to `/usr/sbin/sendmail`; set the
|
|
8
|
+
* `SENDMAIL_PATH` environment variable to use a different binary (e.g.
|
|
9
|
+
* `/usr/lib/sendmail`, or an msmtp/mhsendmail shim in containers). The path
|
|
10
|
+
* is read once at module load.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* On success, `sendMail()` resolves with `accepted` set to the envelope
|
|
14
|
+
* recipients (sendmail queues the message for all of them once the binary
|
|
15
|
+
* exits 0) and `response: 'Messages queued for delivery'`. Failures reject
|
|
16
|
+
* with distinct errors: a missing binary is a `spawn ... ENOENT` error
|
|
17
|
+
* (install sendmail or set `SENDMAIL_PATH`), a binary that exits non-zero is
|
|
18
|
+
* `Sendmail exited with code <n>`, and an envelope address starting with `-`
|
|
19
|
+
* is rejected up front with `Invalid envelope addresses.` (argument-injection
|
|
20
|
+
* guard) — inspect the message/`code` to tell configuration problems apart
|
|
21
|
+
* from delivery problems.
|
|
22
|
+
*
|
|
23
|
+
* The `accepted`-from-envelope mapping above exists because `@types/nodemailer`
|
|
24
|
+
* declares `accepted`/`rejected`/`pending` on `SendmailTransport.SentMessageInfo`
|
|
25
|
+
* (and `SESTransport.SentMessageInfo`), but nodemailer's actual sendmail (and
|
|
26
|
+
* SES) transports never set them — only the SMTP transports do. Code written
|
|
27
|
+
* against the typings type-checks cleanly and reads `undefined`/`[]` at
|
|
28
|
+
* runtime. If you upgrade `nodemailer` or `@types/nodemailer`, re-verify this
|
|
29
|
+
* against the transport implementations themselves
|
|
30
|
+
* (`lib/sendmail-transport/index.js`), not the shipped `.d.ts` — the typings
|
|
31
|
+
* are exactly what drifted last time.
|
|
32
|
+
*
|
|
33
|
+
* @see https://www.npmjs.com/package/nodemailer
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
export * from './browser-guard.js';
|
|
38
|
+
export * from './provider.js';
|
|
39
|
+
export * from './sendMail.js';
|
|
40
|
+
export * from './transport.js';
|
|
41
|
+
export * from './types.js';
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail provider implementation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { EmailTransport } from '@molecule/api-emails';
|
|
7
|
+
/**
|
|
8
|
+
* The sendmail email provider implementing the standard interface.
|
|
9
|
+
*/
|
|
10
|
+
export declare const provider: EmailTransport;
|
|
11
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAI1D;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,cAEtB,CAAA"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail provider implementation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { sendMail } from './sendMail.js';
|
|
7
|
+
/**
|
|
8
|
+
* The sendmail email provider implementing the standard interface.
|
|
9
|
+
*/
|
|
10
|
+
export const provider = {
|
|
11
|
+
sendMail,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAmB;IACtC,QAAQ;CACT,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail email sending functionality.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { EmailMessage, EmailSendResult } from '@molecule/api-emails';
|
|
7
|
+
/**
|
|
8
|
+
* Sends an email using the local sendmail binary via nodemailer.
|
|
9
|
+
*
|
|
10
|
+
* @param message - The email message (to, from, subject, text/html, attachments).
|
|
11
|
+
* @returns Send result with accepted/rejected addresses and message ID.
|
|
12
|
+
*/
|
|
13
|
+
export declare const sendMail: (message: EmailMessage) => Promise<EmailSendResult>;
|
|
14
|
+
//# sourceMappingURL=sendMail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendMail.d.ts","sourceRoot":"","sources":["../src/sendMail.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAMzE;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAU,SAAS,YAAY,KAAG,OAAO,CAAC,eAAe,CAqB7E,CAAA"}
|
package/dist/sendMail.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail email sending functionality.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { getLogger } from '@molecule/api-bond';
|
|
7
|
+
import { nodemailerTransport } from './transport.js';
|
|
8
|
+
const logger = getLogger();
|
|
9
|
+
/**
|
|
10
|
+
* Sends an email using the local sendmail binary via nodemailer.
|
|
11
|
+
*
|
|
12
|
+
* @param message - The email message (to, from, subject, text/html, attachments).
|
|
13
|
+
* @returns Send result with accepted/rejected addresses and message ID.
|
|
14
|
+
*/
|
|
15
|
+
export const sendMail = async (message) => {
|
|
16
|
+
try {
|
|
17
|
+
const result = await nodemailerTransport.sendMail(message);
|
|
18
|
+
return {
|
|
19
|
+
// nodemailer's sendmail transport resolves with `{ envelope, messageId,
|
|
20
|
+
// response }` — it NEVER sets `accepted`/`rejected` (only the SMTP
|
|
21
|
+
// transports do; the @types/nodemailer SentMessageInfo claiming otherwise
|
|
22
|
+
// is type-level drift). Once the binary exits 0 the message is queued for
|
|
23
|
+
// every envelope recipient, so map `envelope.to` to `accepted` — without
|
|
24
|
+
// this, every successful send reported `accepted: []` and callers gating
|
|
25
|
+
// on "was my recipient accepted?" concluded delivery failed.
|
|
26
|
+
accepted: (result.accepted ?? result.envelope?.to ?? []),
|
|
27
|
+
rejected: (result.rejected ?? []),
|
|
28
|
+
messageId: result.messageId,
|
|
29
|
+
response: result.response,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
logger.error('Sendmail sendMail error:', error);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=sendMail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendMail.js","sourceRoot":"","sources":["../src/sendMail.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAqB,EAA4B,EAAE;IAChF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,OAAqC,CAAC,CAAA;QAExF,OAAO;YACL,wEAAwE;YACxE,mEAAmE;YACnE,0EAA0E;YAC1E,0EAA0E;YAC1E,yEAAyE;YACzE,yEAAyE;YACzE,6DAA6D;YAC7D,QAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAa;YACpE,QAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAa;YAC7C,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;QAC/C,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail nodemailer transport configuration.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import nodemailer from 'nodemailer';
|
|
7
|
+
/**
|
|
8
|
+
* The underlying nodemailer transport.
|
|
9
|
+
*
|
|
10
|
+
* The sendmail binary path defaults to `/usr/sbin/sendmail` and can be
|
|
11
|
+
* overridden with the `SENDMAIL_PATH` environment variable (e.g.
|
|
12
|
+
* `/usr/lib/sendmail`, or an msmtp/mhsendmail shim in containers and tests).
|
|
13
|
+
* The path is read once at module load; if the binary is missing, sends fail
|
|
14
|
+
* with a `spawn ... ENOENT` error at send time — install sendmail or point
|
|
15
|
+
* `SENDMAIL_PATH` at a compatible binary.
|
|
16
|
+
*
|
|
17
|
+
* @see https://www.npmjs.com/package/nodemailer
|
|
18
|
+
*/
|
|
19
|
+
export declare const nodemailerTransport: nodemailer.Transporter<import("nodemailer/lib/sendmail-transport/index.js").SentMessageInfo, import("nodemailer/lib/sendmail-transport/index.js").Options>;
|
|
20
|
+
/**
|
|
21
|
+
* Legacy export - the raw nodemailer transport.
|
|
22
|
+
* @deprecated Use sendMail() or provider instead.
|
|
23
|
+
*/
|
|
24
|
+
export declare const transport: nodemailer.Transporter<import("nodemailer/lib/sendmail-transport/index.js").SentMessageInfo, import("nodemailer/lib/sendmail-transport/index.js").Options>;
|
|
25
|
+
/**
|
|
26
|
+
* Legacy export - the raw nodemailer transport.
|
|
27
|
+
* @deprecated Use sendMail() or provider instead.
|
|
28
|
+
*/
|
|
29
|
+
export declare const email: nodemailer.Transporter<import("nodemailer/lib/sendmail-transport/index.js").SentMessageInfo, import("nodemailer/lib/sendmail-transport/index.js").Options>;
|
|
30
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,4JAI9B,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,4JAAsB,CAAA;AAE5C;;;GAGG;AACH,eAAO,MAAM,KAAK,4JAAsB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sendmail nodemailer transport configuration.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import nodemailer from 'nodemailer';
|
|
7
|
+
/**
|
|
8
|
+
* The underlying nodemailer transport.
|
|
9
|
+
*
|
|
10
|
+
* The sendmail binary path defaults to `/usr/sbin/sendmail` and can be
|
|
11
|
+
* overridden with the `SENDMAIL_PATH` environment variable (e.g.
|
|
12
|
+
* `/usr/lib/sendmail`, or an msmtp/mhsendmail shim in containers and tests).
|
|
13
|
+
* The path is read once at module load; if the binary is missing, sends fail
|
|
14
|
+
* with a `spawn ... ENOENT` error at send time — install sendmail or point
|
|
15
|
+
* `SENDMAIL_PATH` at a compatible binary.
|
|
16
|
+
*
|
|
17
|
+
* @see https://www.npmjs.com/package/nodemailer
|
|
18
|
+
*/
|
|
19
|
+
export const nodemailerTransport = nodemailer.createTransport({
|
|
20
|
+
sendmail: true,
|
|
21
|
+
newline: `unix`,
|
|
22
|
+
path: process.env.SENDMAIL_PATH || `/usr/sbin/sendmail`,
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Legacy export - the raw nodemailer transport.
|
|
26
|
+
* @deprecated Use sendMail() or provider instead.
|
|
27
|
+
*/
|
|
28
|
+
export const transport = nodemailerTransport;
|
|
29
|
+
/**
|
|
30
|
+
* Legacy export - the raw nodemailer transport.
|
|
31
|
+
* @deprecated Use sendMail() or provider instead.
|
|
32
|
+
*/
|
|
33
|
+
export const email = nodemailerTransport;
|
|
34
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC,eAAe,CAAC;IAC5D,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,oBAAoB;CACxD,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,mBAAmB,CAAA;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,mBAAmB,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the sendmail email provider.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
export type { EmailMessage, EmailSendResult, EmailTransport } from '@molecule/api-emails';
|
|
7
|
+
declare global {
|
|
8
|
+
namespace NodeJS {
|
|
9
|
+
/**
|
|
10
|
+
* Process Env interface.
|
|
11
|
+
*/
|
|
12
|
+
interface ProcessEnv {
|
|
13
|
+
/**
|
|
14
|
+
* Optional path to the sendmail binary. Defaults to
|
|
15
|
+
* `/usr/sbin/sendmail` when unset. Read once at module load.
|
|
16
|
+
*/
|
|
17
|
+
SENDMAIL_PATH?: string;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEzF,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM,CAAC;QACf;;WAEG;QACH,UAAiB,UAAU;YACzB;;;eAGG;YACH,aAAa,CAAC,EAAE,MAAM,CAAA;SACvB;KACF;CACF"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/api-emails-sendmail",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Sendmail email provider for molecule.dev.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"molecule",
|
|
24
|
+
"email",
|
|
25
|
+
"sendmail",
|
|
26
|
+
"nodemailer"
|
|
27
|
+
],
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"nodemailer": "9.0.3"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@molecule/api-bond": "1.0.0",
|
|
34
|
+
"@types/node": "26.1.2",
|
|
35
|
+
"@types/nodemailer": "8.0.1",
|
|
36
|
+
"typescript": "6.0.3",
|
|
37
|
+
"vitest": "4.1.10"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@molecule/api-bond": "^1.0.0",
|
|
41
|
+
"@molecule/api-emails": "^1.0.0"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
46
|
+
"directory": "packages/api/bonds/emails/sendmail"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/api/bonds/emails/sendmail",
|
|
49
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
}
|
|
53
|
+
}
|