@zintrust/mail-smtp 0.1.12

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/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @zintrust/mail-smtp
2
+
3
+ SMTP mail driver registration for Zintrust.
4
+
5
+ - Docs: https://zintrust.com/mail
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i @zintrust/mail-smtp
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import '@zintrust/mail-smtp/register';
17
+ ```
18
+
19
+ Then set `MAIL_DRIVER=smtp` and configure SMTP settings.
@@ -0,0 +1,3 @@
1
+ declare const SmtpDriver: any;
2
+ export { SmtpDriver };
3
+ export type { SmtpDriverConfig } from '@zintrust/core';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { SmtpDriver as CoreSmtpDriver } from '@zintrust/core';
2
+ const SmtpDriver = CoreSmtpDriver;
3
+ export { SmtpDriver };
@@ -0,0 +1,5 @@
1
+ type Registry = {
2
+ register: (driver: string, handler: (config: unknown, message: unknown) => Promise<unknown>) => void;
3
+ };
4
+ export declare function registerSmtpMailDriver(registry: Registry): Promise<void>;
5
+ export {};
@@ -0,0 +1,23 @@
1
+ export async function registerSmtpMailDriver(registry) {
2
+ const core = (await importCore());
3
+ if (core.SmtpDriver === undefined)
4
+ return;
5
+ registry.register('smtp', (config, message) => core.SmtpDriver.send(config, message));
6
+ }
7
+ const importCore = async () => {
8
+ try {
9
+ return await import('@zintrust/core');
10
+ }
11
+ catch {
12
+ try {
13
+ return await import('@zintrust/core');
14
+ }
15
+ catch {
16
+ return {};
17
+ }
18
+ }
19
+ };
20
+ const core = (await importCore());
21
+ if (core.MailDriverRegistry !== undefined) {
22
+ await registerSmtpMailDriver(core.MailDriverRegistry);
23
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@zintrust/mail-smtp",
3
+ "version": "0.1.12",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./register": {
17
+ "types": "./dist/register.d.ts",
18
+ "default": "./dist/register.js"
19
+ }
20
+ },
21
+ "engines": {
22
+ "node": ">=20.0.0"
23
+ },
24
+ "peerDependencies": {
25
+ "@zintrust/core": "^0.1.12"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "tsc -p tsconfig.json",
32
+ "prepublishOnly": "npm run build"
33
+ }
34
+ }