@igniter-js/mail 0.1.0 → 0.1.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/AGENTS.md +54 -41
- package/CHANGELOG.md +7 -8
- package/README.md +55 -44
- package/dist/adapter-BhnIsrlh.d.mts +60 -0
- package/dist/adapter-BhnIsrlh.d.ts +60 -0
- package/dist/adapters/index.d.mts +229 -0
- package/dist/adapters/index.d.ts +229 -0
- package/dist/adapters/index.js +371 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/index.mjs +361 -0
- package/dist/adapters/index.mjs.map +1 -0
- package/dist/index.d.mts +73 -267
- package/dist/index.d.ts +73 -267
- package/dist/index.js +612 -594
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +609 -580
- package/dist/index.mjs.map +1 -1
- package/dist/shim.d.mts +42 -0
- package/dist/shim.d.ts +42 -0
- package/dist/shim.js +83 -0
- package/dist/shim.js.map +1 -0
- package/dist/shim.mjs +72 -0
- package/dist/shim.mjs.map +1 -0
- package/dist/telemetry/index.d.mts +59 -0
- package/dist/telemetry/index.d.ts +59 -0
- package/dist/telemetry/index.js +71 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/index.mjs +69 -0
- package/dist/telemetry/index.mjs.map +1 -0
- package/package.json +27 -2
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { I as IgniterMailAdapter, b as IgniterMailAdapterCredentials, a as IgniterMailAdapterSendParams } from '../adapter-BhnIsrlh.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Postmark adapter.
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* - This implementation uses `fetch` (no SDK dependency).
|
|
8
|
+
* - Designed to be extracted to `@igniter-js/mail/adapters/postmark`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const adapter = PostmarkMailAdapter.create({
|
|
13
|
+
* secret: process.env.POSTMARK_SERVER_TOKEN,
|
|
14
|
+
* from: 'no-reply@example.com',
|
|
15
|
+
* })
|
|
16
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hello', html: '<p>Hi</p>', text: 'Hi' })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare class PostmarkMailAdapter implements IgniterMailAdapter {
|
|
20
|
+
private readonly credentials;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new adapter instance.
|
|
23
|
+
*
|
|
24
|
+
* @param credentials - Provider credentials (secret/from).
|
|
25
|
+
* @returns A Postmark adapter instance.
|
|
26
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const adapter = PostmarkMailAdapter.create({ secret: 'token', from: 'no-reply@acme.com' })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
static create(credentials: IgniterMailAdapterCredentials): PostmarkMailAdapter;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new adapter instance.
|
|
35
|
+
*
|
|
36
|
+
* @param credentials - Provider credentials (secret/from).
|
|
37
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
38
|
+
*/
|
|
39
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
40
|
+
/**
|
|
41
|
+
* Sends an email using Postmark (HTTP API).
|
|
42
|
+
*
|
|
43
|
+
* @param params - Normalized email parameters.
|
|
44
|
+
* @returns A promise that resolves when the email is accepted.
|
|
45
|
+
* @throws {IgniterMailError} When configuration is invalid or Postmark rejects the request.
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hello', html: '<p>Hi</p>', text: 'Hi' })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Resend adapter implementation.
|
|
56
|
+
*
|
|
57
|
+
* Notes:
|
|
58
|
+
* - Uses the Resend SDK.
|
|
59
|
+
* - Designed to be extracted to `@igniter-js/mail/adapters/resend`.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const adapter = ResendMailAdapter.create({
|
|
64
|
+
* secret: process.env.RESEND_API_KEY,
|
|
65
|
+
* from: 'no-reply@example.com',
|
|
66
|
+
* })
|
|
67
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare class ResendMailAdapter implements IgniterMailAdapter {
|
|
71
|
+
private readonly credentials;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new adapter instance.
|
|
74
|
+
*
|
|
75
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
76
|
+
* @returns A configured Resend adapter.
|
|
77
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const adapter = ResendMailAdapter.create({ secret: 'token', from: 'no-reply@acme.com' })
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
static create(credentials: IgniterMailAdapterCredentials): ResendMailAdapter;
|
|
84
|
+
/**
|
|
85
|
+
* Creates an adapter with credentials.
|
|
86
|
+
*
|
|
87
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
88
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
89
|
+
*/
|
|
90
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
91
|
+
/**
|
|
92
|
+
* Sends an email using Resend.
|
|
93
|
+
*
|
|
94
|
+
* @param params - Email payload to send.
|
|
95
|
+
* @returns Resolves when the email is accepted by Resend.
|
|
96
|
+
* @throws {IgniterMailError} When credentials are missing or Resend rejects the request.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Welcome', html: '<p>Hi</p>', text: 'Hi' })
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* SendGrid adapter implementation.
|
|
108
|
+
*
|
|
109
|
+
* Notes:
|
|
110
|
+
* - This implementation uses `fetch` (no SDK dependency).
|
|
111
|
+
* - Designed to be extracted to `@igniter-js/mail/adapters/sendgrid`.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const adapter = SendGridMailAdapter.create({
|
|
116
|
+
* secret: process.env.SENDGRID_API_KEY,
|
|
117
|
+
* from: 'no-reply@example.com',
|
|
118
|
+
* })
|
|
119
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hello', html: '<p>Hi</p>', text: 'Hi' })
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare class SendGridMailAdapter implements IgniterMailAdapter {
|
|
123
|
+
private readonly credentials;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new adapter instance.
|
|
126
|
+
*
|
|
127
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
128
|
+
* @returns A configured SendGrid adapter.
|
|
129
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const adapter = SendGridMailAdapter.create({ secret: 'token', from: 'no-reply@acme.com' })
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
static create(credentials: IgniterMailAdapterCredentials): SendGridMailAdapter;
|
|
136
|
+
/**
|
|
137
|
+
* Creates an adapter with credentials.
|
|
138
|
+
*
|
|
139
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
140
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
141
|
+
*/
|
|
142
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
143
|
+
/**
|
|
144
|
+
* Sends an email using SendGrid (HTTP API).
|
|
145
|
+
*
|
|
146
|
+
* @param params - Email payload to send.
|
|
147
|
+
* @returns Resolves when the email is accepted by SendGrid.
|
|
148
|
+
* @throws {IgniterMailError} When credentials are missing or the API fails.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* SMTP adapter implementation.
|
|
160
|
+
*
|
|
161
|
+
* Notes:
|
|
162
|
+
* - Uses Nodemailer.
|
|
163
|
+
* - `credentials.secret` must be an SMTP connection URL.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* const adapter = SmtpMailAdapter.create({
|
|
168
|
+
* secret: 'smtps://user:pass@host:465',
|
|
169
|
+
* from: 'no-reply@example.com',
|
|
170
|
+
* })
|
|
171
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare class SmtpMailAdapter implements IgniterMailAdapter {
|
|
175
|
+
private readonly credentials;
|
|
176
|
+
/**
|
|
177
|
+
* Creates a new adapter instance.
|
|
178
|
+
*
|
|
179
|
+
* @param credentials - Adapter credentials including SMTP URL and default from.
|
|
180
|
+
* @returns A configured SMTP adapter.
|
|
181
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* const adapter = SmtpMailAdapter.create({ secret: 'smtps://user:pass@host:465', from: 'no-reply@acme.com' })
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
static create(credentials: IgniterMailAdapterCredentials): SmtpMailAdapter;
|
|
188
|
+
/**
|
|
189
|
+
* Creates an adapter with credentials.
|
|
190
|
+
*
|
|
191
|
+
* @param credentials - Adapter credentials including SMTP URL and default from.
|
|
192
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
193
|
+
*/
|
|
194
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
195
|
+
/**
|
|
196
|
+
* Sends an email using Nodemailer over SMTP.
|
|
197
|
+
*
|
|
198
|
+
* @param params - Email payload to send.
|
|
199
|
+
* @returns Resolves when the email is sent.
|
|
200
|
+
* @throws {IgniterMailError} When credentials are missing or the SMTP send fails.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* In-memory mock adapter for `@igniter-js/mail`.
|
|
212
|
+
*
|
|
213
|
+
* Use this in tests to avoid real provider calls.
|
|
214
|
+
*/
|
|
215
|
+
declare class MockMailAdapter implements IgniterMailAdapter {
|
|
216
|
+
/** Creates a new mock adapter instance. */
|
|
217
|
+
static create(): MockMailAdapter;
|
|
218
|
+
/** Tracks all send calls. */
|
|
219
|
+
readonly sent: IgniterMailAdapterSendParams[];
|
|
220
|
+
/** Tracks method call counts. */
|
|
221
|
+
readonly calls: {
|
|
222
|
+
send: number;
|
|
223
|
+
};
|
|
224
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
225
|
+
/** Clears all tracked state. */
|
|
226
|
+
clear(): void;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export { IgniterMailAdapter, IgniterMailAdapterCredentials, IgniterMailAdapterSendParams, MockMailAdapter, PostmarkMailAdapter, ResendMailAdapter, SendGridMailAdapter, SmtpMailAdapter };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { I as IgniterMailAdapter, b as IgniterMailAdapterCredentials, a as IgniterMailAdapterSendParams } from '../adapter-BhnIsrlh.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Postmark adapter.
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* - This implementation uses `fetch` (no SDK dependency).
|
|
8
|
+
* - Designed to be extracted to `@igniter-js/mail/adapters/postmark`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const adapter = PostmarkMailAdapter.create({
|
|
13
|
+
* secret: process.env.POSTMARK_SERVER_TOKEN,
|
|
14
|
+
* from: 'no-reply@example.com',
|
|
15
|
+
* })
|
|
16
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hello', html: '<p>Hi</p>', text: 'Hi' })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare class PostmarkMailAdapter implements IgniterMailAdapter {
|
|
20
|
+
private readonly credentials;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new adapter instance.
|
|
23
|
+
*
|
|
24
|
+
* @param credentials - Provider credentials (secret/from).
|
|
25
|
+
* @returns A Postmark adapter instance.
|
|
26
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const adapter = PostmarkMailAdapter.create({ secret: 'token', from: 'no-reply@acme.com' })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
static create(credentials: IgniterMailAdapterCredentials): PostmarkMailAdapter;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new adapter instance.
|
|
35
|
+
*
|
|
36
|
+
* @param credentials - Provider credentials (secret/from).
|
|
37
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
38
|
+
*/
|
|
39
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
40
|
+
/**
|
|
41
|
+
* Sends an email using Postmark (HTTP API).
|
|
42
|
+
*
|
|
43
|
+
* @param params - Normalized email parameters.
|
|
44
|
+
* @returns A promise that resolves when the email is accepted.
|
|
45
|
+
* @throws {IgniterMailError} When configuration is invalid or Postmark rejects the request.
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hello', html: '<p>Hi</p>', text: 'Hi' })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Resend adapter implementation.
|
|
56
|
+
*
|
|
57
|
+
* Notes:
|
|
58
|
+
* - Uses the Resend SDK.
|
|
59
|
+
* - Designed to be extracted to `@igniter-js/mail/adapters/resend`.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const adapter = ResendMailAdapter.create({
|
|
64
|
+
* secret: process.env.RESEND_API_KEY,
|
|
65
|
+
* from: 'no-reply@example.com',
|
|
66
|
+
* })
|
|
67
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare class ResendMailAdapter implements IgniterMailAdapter {
|
|
71
|
+
private readonly credentials;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new adapter instance.
|
|
74
|
+
*
|
|
75
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
76
|
+
* @returns A configured Resend adapter.
|
|
77
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const adapter = ResendMailAdapter.create({ secret: 'token', from: 'no-reply@acme.com' })
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
static create(credentials: IgniterMailAdapterCredentials): ResendMailAdapter;
|
|
84
|
+
/**
|
|
85
|
+
* Creates an adapter with credentials.
|
|
86
|
+
*
|
|
87
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
88
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
89
|
+
*/
|
|
90
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
91
|
+
/**
|
|
92
|
+
* Sends an email using Resend.
|
|
93
|
+
*
|
|
94
|
+
* @param params - Email payload to send.
|
|
95
|
+
* @returns Resolves when the email is accepted by Resend.
|
|
96
|
+
* @throws {IgniterMailError} When credentials are missing or Resend rejects the request.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Welcome', html: '<p>Hi</p>', text: 'Hi' })
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* SendGrid adapter implementation.
|
|
108
|
+
*
|
|
109
|
+
* Notes:
|
|
110
|
+
* - This implementation uses `fetch` (no SDK dependency).
|
|
111
|
+
* - Designed to be extracted to `@igniter-js/mail/adapters/sendgrid`.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const adapter = SendGridMailAdapter.create({
|
|
116
|
+
* secret: process.env.SENDGRID_API_KEY,
|
|
117
|
+
* from: 'no-reply@example.com',
|
|
118
|
+
* })
|
|
119
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hello', html: '<p>Hi</p>', text: 'Hi' })
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare class SendGridMailAdapter implements IgniterMailAdapter {
|
|
123
|
+
private readonly credentials;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new adapter instance.
|
|
126
|
+
*
|
|
127
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
128
|
+
* @returns A configured SendGrid adapter.
|
|
129
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const adapter = SendGridMailAdapter.create({ secret: 'token', from: 'no-reply@acme.com' })
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
static create(credentials: IgniterMailAdapterCredentials): SendGridMailAdapter;
|
|
136
|
+
/**
|
|
137
|
+
* Creates an adapter with credentials.
|
|
138
|
+
*
|
|
139
|
+
* @param credentials - Adapter credentials including API secret and default from.
|
|
140
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
141
|
+
*/
|
|
142
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
143
|
+
/**
|
|
144
|
+
* Sends an email using SendGrid (HTTP API).
|
|
145
|
+
*
|
|
146
|
+
* @param params - Email payload to send.
|
|
147
|
+
* @returns Resolves when the email is accepted by SendGrid.
|
|
148
|
+
* @throws {IgniterMailError} When credentials are missing or the API fails.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* SMTP adapter implementation.
|
|
160
|
+
*
|
|
161
|
+
* Notes:
|
|
162
|
+
* - Uses Nodemailer.
|
|
163
|
+
* - `credentials.secret` must be an SMTP connection URL.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* const adapter = SmtpMailAdapter.create({
|
|
168
|
+
* secret: 'smtps://user:pass@host:465',
|
|
169
|
+
* from: 'no-reply@example.com',
|
|
170
|
+
* })
|
|
171
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare class SmtpMailAdapter implements IgniterMailAdapter {
|
|
175
|
+
private readonly credentials;
|
|
176
|
+
/**
|
|
177
|
+
* Creates a new adapter instance.
|
|
178
|
+
*
|
|
179
|
+
* @param credentials - Adapter credentials including SMTP URL and default from.
|
|
180
|
+
* @returns A configured SMTP adapter.
|
|
181
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* const adapter = SmtpMailAdapter.create({ secret: 'smtps://user:pass@host:465', from: 'no-reply@acme.com' })
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
static create(credentials: IgniterMailAdapterCredentials): SmtpMailAdapter;
|
|
188
|
+
/**
|
|
189
|
+
* Creates an adapter with credentials.
|
|
190
|
+
*
|
|
191
|
+
* @param credentials - Adapter credentials including SMTP URL and default from.
|
|
192
|
+
* @throws {IgniterMailError} Does not throw on creation; errors surface on send.
|
|
193
|
+
*/
|
|
194
|
+
constructor(credentials?: IgniterMailAdapterCredentials);
|
|
195
|
+
/**
|
|
196
|
+
* Sends an email using Nodemailer over SMTP.
|
|
197
|
+
*
|
|
198
|
+
* @param params - Email payload to send.
|
|
199
|
+
* @returns Resolves when the email is sent.
|
|
200
|
+
* @throws {IgniterMailError} When credentials are missing or the SMTP send fails.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* await adapter.send({ to: 'user@example.com', subject: 'Hi', html: '<p>Hi</p>', text: 'Hi' })
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* In-memory mock adapter for `@igniter-js/mail`.
|
|
212
|
+
*
|
|
213
|
+
* Use this in tests to avoid real provider calls.
|
|
214
|
+
*/
|
|
215
|
+
declare class MockMailAdapter implements IgniterMailAdapter {
|
|
216
|
+
/** Creates a new mock adapter instance. */
|
|
217
|
+
static create(): MockMailAdapter;
|
|
218
|
+
/** Tracks all send calls. */
|
|
219
|
+
readonly sent: IgniterMailAdapterSendParams[];
|
|
220
|
+
/** Tracks method call counts. */
|
|
221
|
+
readonly calls: {
|
|
222
|
+
send: number;
|
|
223
|
+
};
|
|
224
|
+
send(params: IgniterMailAdapterSendParams): Promise<void>;
|
|
225
|
+
/** Clears all tracked state. */
|
|
226
|
+
clear(): void;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export { IgniterMailAdapter, IgniterMailAdapterCredentials, IgniterMailAdapterSendParams, MockMailAdapter, PostmarkMailAdapter, ResendMailAdapter, SendGridMailAdapter, SmtpMailAdapter };
|