@visulima/email 1.0.0-alpha.16 → 1.0.0-alpha.18
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/CHANGELOG.md +14 -0
- package/LICENSE.md +303 -483
- package/dist/crypto/index.d.ts +147 -4
- package/dist/index.d.ts +785 -9
- package/dist/packem_shared/provider.d-DcfYeGJJ.d.ts +28 -0
- package/dist/packem_shared/types.d-CNnnk-Ya.d.ts +102 -0
- package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
- package/dist/packem_shared/types.d-wwpgA3to.d.ts +204 -0
- package/dist/providers/ahasend/index.d.ts +36 -3
- package/dist/providers/aws-ses/index.d.ts +47 -3
- package/dist/providers/azure/index.d.ts +52 -3
- package/dist/providers/brevo/index.d.ts +65 -3
- package/dist/providers/failover/index.d.ts +27 -3
- package/dist/providers/http/index.d.ts +35 -3
- package/dist/providers/infobip/index.d.ts +56 -3
- package/dist/providers/mailcrab/index.d.ts +32 -3
- package/dist/providers/mailersend/index.d.ts +51 -3
- package/dist/providers/mailgun/index.d.ts +73 -3
- package/dist/providers/mailjet/index.d.ts +72 -3
- package/dist/providers/mailomat/index.d.ts +40 -3
- package/dist/providers/mailpace/index.d.ts +52 -3
- package/dist/providers/mailtrap/index.d.ts +44 -3
- package/dist/providers/mandrill/index.d.ts +87 -3
- package/dist/providers/mock/index.d.ts +59 -3
- package/dist/providers/nodemailer/index.d.ts +38 -3
- package/dist/providers/opentelemetry/index.d.ts +529 -3
- package/dist/providers/plunk/index.d.ts +38 -3
- package/dist/providers/postal/index.d.ts +48 -3
- package/dist/providers/postmark/index.d.ts +60 -3
- package/dist/providers/resend/index.d.ts +51 -3
- package/dist/providers/roundrobin/index.d.ts +27 -3
- package/dist/providers/scaleway/index.d.ts +44 -3
- package/dist/providers/sendgrid/index.d.ts +84 -3
- package/dist/providers/smtp/index.d.ts +71 -3
- package/dist/providers/sweego/index.d.ts +40 -3
- package/dist/providers/zeptomail/index.d.ts +37 -3
- package/dist/template-engines/handlebars.d.ts +23 -22
- package/dist/template-engines/html-to-text.d.ts +24 -24
- package/dist/template-engines/mjml.d.ts +10 -10
- package/dist/template-engines/react-email.d.ts +9 -9
- package/dist/template-engines/vue-email.d.ts +9 -9
- package/dist/utils/cache.d.ts +49 -48
- package/dist/utils/format-email-address.d.ts +8 -7
- package/dist/utils/normalize-email-aliases.d.ts +20 -20
- package/dist/utils/parse-address.d.ts +18 -17
- package/dist/utils/validation/check-mx-records.d.ts +36 -35
- package/dist/utils/validation/disposable-email-domains.d.ts +1 -13
- package/dist/utils/validation/role-accounts.d.ts +18 -18
- package/dist/utils/validation/validate-email.d.ts +5 -5
- package/dist/utils/validation/verify-email.d.ts +45 -42
- package/dist/utils/validation/verify-smtp.d.ts +35 -34
- package/package.json +37 -37
- package/dist/attachment-helpers.d.ts +0 -64
- package/dist/crypto/dkim-signer.d.ts +0 -48
- package/dist/crypto/smime-encrypter.d.ts +0 -53
- package/dist/crypto/smime-signer.d.ts +0 -48
- package/dist/crypto/types.d.ts +0 -101
- package/dist/draft-mail-message.d.ts +0 -13
- package/dist/errors/email-error.d.ts +0 -17
- package/dist/errors/required-option-error.d.ts +0 -10
- package/dist/mail-message.d.ts +0 -425
- package/dist/mail.d.ts +0 -206
- package/dist/providers/ahasend/provider.d.ts +0 -7
- package/dist/providers/ahasend/types.d.ts +0 -28
- package/dist/providers/aws-ses/provider.d.ts +0 -8
- package/dist/providers/aws-ses/types.d.ts +0 -38
- package/dist/providers/azure/provider.d.ts +0 -7
- package/dist/providers/azure/types.d.ts +0 -44
- package/dist/providers/brevo/provider.d.ts +0 -7
- package/dist/providers/brevo/types.d.ts +0 -57
- package/dist/providers/failover/provider.d.ts +0 -7
- package/dist/providers/failover/types.d.ts +0 -19
- package/dist/providers/http/provider.d.ts +0 -7
- package/dist/providers/http/types.d.ts +0 -27
- package/dist/providers/infobip/provider.d.ts +0 -7
- package/dist/providers/infobip/types.d.ts +0 -48
- package/dist/providers/mailcrab/provider.d.ts +0 -9
- package/dist/providers/mailcrab/types.d.ts +0 -22
- package/dist/providers/mailersend/provider.d.ts +0 -7
- package/dist/providers/mailersend/types.d.ts +0 -43
- package/dist/providers/mailgun/provider.d.ts +0 -7
- package/dist/providers/mailgun/types.d.ts +0 -65
- package/dist/providers/mailjet/provider.d.ts +0 -7
- package/dist/providers/mailjet/types.d.ts +0 -64
- package/dist/providers/mailomat/provider.d.ts +0 -7
- package/dist/providers/mailomat/types.d.ts +0 -32
- package/dist/providers/mailpace/provider.d.ts +0 -7
- package/dist/providers/mailpace/types.d.ts +0 -44
- package/dist/providers/mailtrap/provider.d.ts +0 -7
- package/dist/providers/mailtrap/types.d.ts +0 -36
- package/dist/providers/mandrill/provider.d.ts +0 -7
- package/dist/providers/mandrill/types.d.ts +0 -79
- package/dist/providers/mock/provider.d.ts +0 -8
- package/dist/providers/mock/types.d.ts +0 -50
- package/dist/providers/nodemailer/provider.d.ts +0 -7
- package/dist/providers/nodemailer/types.d.ts +0 -30
- package/dist/providers/opentelemetry/provider.d.ts +0 -7
- package/dist/providers/opentelemetry/types.d.ts +0 -31
- package/dist/providers/plunk/provider.d.ts +0 -7
- package/dist/providers/plunk/types.d.ts +0 -30
- package/dist/providers/postal/provider.d.ts +0 -7
- package/dist/providers/postal/types.d.ts +0 -40
- package/dist/providers/postmark/provider.d.ts +0 -7
- package/dist/providers/postmark/types.d.ts +0 -52
- package/dist/providers/provider.d.ts +0 -27
- package/dist/providers/resend/provider.d.ts +0 -7
- package/dist/providers/resend/types.d.ts +0 -43
- package/dist/providers/roundrobin/provider.d.ts +0 -7
- package/dist/providers/roundrobin/types.d.ts +0 -19
- package/dist/providers/scaleway/provider.d.ts +0 -7
- package/dist/providers/scaleway/types.d.ts +0 -36
- package/dist/providers/sendgrid/provider.d.ts +0 -7
- package/dist/providers/sendgrid/types.d.ts +0 -76
- package/dist/providers/smtp/provider.d.ts +0 -7
- package/dist/providers/smtp/types.d.ts +0 -63
- package/dist/providers/sweego/provider.d.ts +0 -7
- package/dist/providers/sweego/types.d.ts +0 -32
- package/dist/providers/utils/address-formatter.d.ts +0 -139
- package/dist/providers/utils/attachment-processor.d.ts +0 -58
- package/dist/providers/utils/index.d.ts +0 -4
- package/dist/providers/utils/payload-builder.d.ts +0 -78
- package/dist/providers/utils/provider-base.d.ts +0 -69
- package/dist/providers/zeptomail/provider.d.ts +0 -7
- package/dist/providers/zeptomail/types.d.ts +0 -29
- package/dist/template-engines/types.d.ts +0 -8
- package/dist/types.d.ts +0 -203
- package/dist/utils/build-mime-message.d.ts +0 -8
- package/dist/utils/create-logger.d.ts +0 -16
- package/dist/utils/format-email-addresses.d.ts +0 -8
- package/dist/utils/generate-boundary.d.ts +0 -7
- package/dist/utils/generate-message-id.d.ts +0 -6
- package/dist/utils/headers-to-record.d.ts +0 -9
- package/dist/utils/is-port-available.d.ts +0 -9
- package/dist/utils/make-request.d.ts +0 -18
- package/dist/utils/retry.d.ts +0 -10
- package/dist/utils/sanitize-header.d.ts +0 -14
- package/dist/utils/to-base64.d.ts +0 -8
- package/dist/utils/validation/validate-email-options.d.ts +0 -8
package/dist/mail.d.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import DraftMailMessage from "./draft-mail-message.d.ts";
|
|
2
|
-
import MailMessage from "./mail-message.d.ts";
|
|
3
|
-
import type { Provider } from "./providers/provider.d.ts";
|
|
4
|
-
import type { EmailAddress, EmailHeaders, EmailOptions, EmailResult, Receipt, Result } from "./types.d.ts";
|
|
5
|
-
/**
|
|
6
|
-
* Type alias for messages that can be sent via Mail.send().
|
|
7
|
-
*/
|
|
8
|
-
export type SendableMessage = MailMessage | EmailOptions;
|
|
9
|
-
/**
|
|
10
|
-
* Global email configuration that applies to all emails sent through a Mail instance.
|
|
11
|
-
*/
|
|
12
|
-
export interface MailGlobalConfig {
|
|
13
|
-
/**
|
|
14
|
-
* Default from address to use if not specified in the message.
|
|
15
|
-
*/
|
|
16
|
-
from?: EmailAddress;
|
|
17
|
-
/**
|
|
18
|
-
* Global headers to add to all emails.
|
|
19
|
-
* These will be merged with message-specific headers, with message headers taking precedence.
|
|
20
|
-
*/
|
|
21
|
-
headers?: EmailHeaders;
|
|
22
|
-
/**
|
|
23
|
-
* Default reply-to address to use if not specified in the message.
|
|
24
|
-
*/
|
|
25
|
-
replyTo?: EmailAddress;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Mail class - instance-based email sending.
|
|
29
|
-
*/
|
|
30
|
-
export declare class Mail {
|
|
31
|
-
/**
|
|
32
|
-
* Extracts error messages from an error object.
|
|
33
|
-
* @param error Error object to extract messages from.
|
|
34
|
-
* @returns Array of error messages.
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
private static extractErrorMessages;
|
|
38
|
-
private provider;
|
|
39
|
-
private logger?;
|
|
40
|
-
private loggerInstance?;
|
|
41
|
-
private globalConfig?;
|
|
42
|
-
/**
|
|
43
|
-
* Creates a new Mail instance with a provider.
|
|
44
|
-
* @param provider The email provider instance.
|
|
45
|
-
*/
|
|
46
|
-
constructor(provider: Provider);
|
|
47
|
-
/**
|
|
48
|
-
* Sets the logger instance for this mail instance.
|
|
49
|
-
* @param logger The logger instance (Console) to use for logging.
|
|
50
|
-
* @returns This instance for method chaining.
|
|
51
|
-
* @example
|
|
52
|
-
* ```ts
|
|
53
|
-
* const mail = createMail(provider);
|
|
54
|
-
* mail.setLogger(console);
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
setLogger(logger: Console): this;
|
|
58
|
-
/**
|
|
59
|
-
* Sets the default from address for all emails sent through this Mail instance.
|
|
60
|
-
* @param from Default from address to use if not specified in the message.
|
|
61
|
-
* @returns This instance for method chaining.
|
|
62
|
-
* @example
|
|
63
|
-
* ```ts
|
|
64
|
-
* const mail = createMail(provider);
|
|
65
|
-
* mail.setFrom({ email: "noreply@example.com", name: "My App" });
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
setFrom(from: EmailAddress): this;
|
|
69
|
-
/**
|
|
70
|
-
* Sets the default reply-to address for all emails sent through this Mail instance.
|
|
71
|
-
* @param replyTo Default reply-to address to use if not specified in the message.
|
|
72
|
-
* @returns This instance for method chaining.
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* const mail = createMail(provider);
|
|
76
|
-
* mail.setReplyTo({ email: "support@example.com" });
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
setReplyTo(replyTo: EmailAddress): this;
|
|
80
|
-
/**
|
|
81
|
-
* Sets default headers for all emails sent through this Mail instance.
|
|
82
|
-
* These headers will be merged with message-specific headers, with message headers taking precedence.
|
|
83
|
-
* @param headers Default headers to add to all emails.
|
|
84
|
-
* @returns This instance for method chaining.
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* const mail = createMail(provider);
|
|
88
|
-
* mail.setHeaders({ "X-App-Name": "MyApp", "X-Version": "1.0.0" });
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
setHeaders(headers: EmailHeaders): this;
|
|
92
|
-
/**
|
|
93
|
-
* Creates a draft email in EML (RFC 822) format without sending it.
|
|
94
|
-
* This is useful for previewing, saving for later, or testing email content.
|
|
95
|
-
* @param message The message to create a draft from (MailMessage or EmailOptions).
|
|
96
|
-
* @returns The email in EML (RFC 822) format as a string with X-Unsent: 1 header.
|
|
97
|
-
* @example
|
|
98
|
-
* ```ts
|
|
99
|
-
* // Create a draft from MailMessage
|
|
100
|
-
* const message = new MailMessage()
|
|
101
|
-
* .to("user@example.com")
|
|
102
|
-
* .from("sender@example.com")
|
|
103
|
-
* .subject("Hello")
|
|
104
|
-
* .html("<h1>Hello World</h1>");
|
|
105
|
-
*
|
|
106
|
-
* const eml = await mail.draft(message);
|
|
107
|
-
* console.log("Draft EML:", eml);
|
|
108
|
-
*
|
|
109
|
-
* // Save to file
|
|
110
|
-
* await fs.writeFile("draft.eml", eml);
|
|
111
|
-
*
|
|
112
|
-
* // Or send later by parsing the EML back to EmailOptions
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
draft(message: SendableMessage | DraftMailMessage): Promise<string>;
|
|
116
|
-
/**
|
|
117
|
-
* Sends an email message or email options.
|
|
118
|
-
* @param message The message to send (MailMessage or EmailOptions).
|
|
119
|
-
* @returns A result object containing the email result or error.
|
|
120
|
-
* @example
|
|
121
|
-
* ```ts
|
|
122
|
-
* // Using MailMessage
|
|
123
|
-
* const message = new MailMessage()
|
|
124
|
-
* .to("user@example.com")
|
|
125
|
-
* .from("sender@example.com")
|
|
126
|
-
* .subject("Hello")
|
|
127
|
-
* .html("<h1>Hello World</h1>");
|
|
128
|
-
* await mail.send(message);
|
|
129
|
-
*
|
|
130
|
-
* // Using EmailOptions
|
|
131
|
-
* await mail.send({
|
|
132
|
-
* to: "user@example.com",
|
|
133
|
-
* from: "sender@example.com",
|
|
134
|
-
* subject: "Hello",
|
|
135
|
-
* html: "<h1>Hello World</h1>"
|
|
136
|
-
* });
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
send(message: SendableMessage): Promise<Result<EmailResult>>;
|
|
140
|
-
/**
|
|
141
|
-
* Sends multiple messages using the email service.
|
|
142
|
-
* Returns an async iterable that yields receipts for each sent message.
|
|
143
|
-
* @example
|
|
144
|
-
* ```ts
|
|
145
|
-
* const messages = [
|
|
146
|
-
* { from: "sender@example.com", to: "user1@example.com", subject: "Hello 1", html: "<h1>Hello</h1>" },
|
|
147
|
-
* { from: "sender@example.com", to: "user2@example.com", subject: "Hello 2", html: "<h1>Hello</h1>" },
|
|
148
|
-
* ];
|
|
149
|
-
*
|
|
150
|
-
* for await (const receipt of mail.sendMany(messages)) {
|
|
151
|
-
* if (receipt.successful) {
|
|
152
|
-
* console.log("Sent:", receipt.messageId);
|
|
153
|
-
* } else {
|
|
154
|
-
* console.error("Failed:", receipt.errorMessages);
|
|
155
|
-
* }
|
|
156
|
-
* }
|
|
157
|
-
* ```
|
|
158
|
-
* @param messages An iterable of MailMessage instances or email options to send.
|
|
159
|
-
* @param options Optional parameters for sending.
|
|
160
|
-
* @param options.signal Abort signal to cancel the operation.
|
|
161
|
-
* @returns An async iterable that yields receipts for each sent message.
|
|
162
|
-
*/
|
|
163
|
-
sendMany(messages: Iterable<SendableMessage> | AsyncIterable<SendableMessage>, options?: {
|
|
164
|
-
signal?: AbortSignal;
|
|
165
|
-
}): AsyncIterable<Receipt>;
|
|
166
|
-
/**
|
|
167
|
-
* Builds email options from a MailMessage instance for draft creation.
|
|
168
|
-
* Applies global configuration before building to ensure required fields are set.
|
|
169
|
-
* @param message The MailMessage or DraftMailMessage instance.
|
|
170
|
-
* @returns Built email options.
|
|
171
|
-
* @private
|
|
172
|
-
*/
|
|
173
|
-
private buildDraftFromMessage;
|
|
174
|
-
/**
|
|
175
|
-
* Builds email options from EmailOptions for draft creation.
|
|
176
|
-
* @param options The EmailOptions object.
|
|
177
|
-
* @returns Email options.
|
|
178
|
-
* @private
|
|
179
|
-
*/
|
|
180
|
-
private buildDraftFromOptions;
|
|
181
|
-
/**
|
|
182
|
-
* Applies global configuration to a MailMessage instance.
|
|
183
|
-
* @param message The MailMessage or DraftMailMessage instance.
|
|
184
|
-
* @private
|
|
185
|
-
*/
|
|
186
|
-
private applyGlobalConfigToMessage;
|
|
187
|
-
/**
|
|
188
|
-
* Applies global configuration to email options.
|
|
189
|
-
* Global values are only applied if the corresponding field is not already set in the email options.
|
|
190
|
-
* @param emailOptions The email options to apply global configuration to.
|
|
191
|
-
* @returns Email options with global configuration applied.
|
|
192
|
-
* @private
|
|
193
|
-
*/
|
|
194
|
-
private applyGlobalConfig;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Creates a new Mail instance with a provider.
|
|
198
|
-
* @param provider The email provider instance.
|
|
199
|
-
* @returns A new Mail instance.
|
|
200
|
-
* @example
|
|
201
|
-
* ```ts
|
|
202
|
-
* const mail = createMail(provider);
|
|
203
|
-
* mail.setFrom({ email: "noreply@example.com", name: "My App" });
|
|
204
|
-
* ```
|
|
205
|
-
*/
|
|
206
|
-
export declare const createMail: (provider: Provider) => Mail;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { AhaSendConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* AhaSend Provider for sending emails through AhaSend API
|
|
5
|
-
*/
|
|
6
|
-
declare const ahaSendProvider: ProviderFactory<AhaSendConfig>;
|
|
7
|
-
export default ahaSendProvider;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* AhaSend configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface AhaSendConfig extends BaseConfig {
|
|
6
|
-
/**
|
|
7
|
-
* AhaSend API key
|
|
8
|
-
*/
|
|
9
|
-
apiKey: string;
|
|
10
|
-
/**
|
|
11
|
-
* AhaSend API endpoint
|
|
12
|
-
* Defaults to: https://api.ahasend.com
|
|
13
|
-
*/
|
|
14
|
-
endpoint?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* AhaSend-specific email options
|
|
18
|
-
*/
|
|
19
|
-
export interface AhaSendEmailOptions extends EmailOptions {
|
|
20
|
-
/**
|
|
21
|
-
* AhaSend template ID for template-based emails
|
|
22
|
-
*/
|
|
23
|
-
templateId?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Template variables for AhaSend templates
|
|
26
|
-
*/
|
|
27
|
-
templateVariables?: Record<string, unknown>;
|
|
28
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { AwsSesConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* AWS SES Email Provider Implementation - Zero dependency version
|
|
5
|
-
* Uses native Node.js APIs instead of AWS SDK
|
|
6
|
-
*/
|
|
7
|
-
declare const awsSesProvider: ProviderFactory<AwsSesConfig>;
|
|
8
|
-
export default awsSesProvider;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* AWS SES configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface AwsSesConfig extends BaseConfig {
|
|
6
|
-
accessKeyId: string;
|
|
7
|
-
apiVersion?: string;
|
|
8
|
-
endpoint?: string;
|
|
9
|
-
maxAttempts?: number;
|
|
10
|
-
region: string;
|
|
11
|
-
secretAccessKey: string;
|
|
12
|
-
sessionToken?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* AWS SES-specific email options
|
|
16
|
-
*/
|
|
17
|
-
export interface AwsSesEmailOptions extends EmailOptions {
|
|
18
|
-
/**
|
|
19
|
-
* Configuration set name
|
|
20
|
-
*/
|
|
21
|
-
configurationSetName?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Message tags as key-value pairs
|
|
24
|
-
*/
|
|
25
|
-
messageTags?: Record<string, string>;
|
|
26
|
-
/**
|
|
27
|
-
* Return path email address
|
|
28
|
-
*/
|
|
29
|
-
returnPath?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Return path ARN
|
|
32
|
-
*/
|
|
33
|
-
returnPathArn?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Source ARN for sending authorization
|
|
36
|
-
*/
|
|
37
|
-
sourceArn?: string;
|
|
38
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { AzureConfig, AzureEmailOptions } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Azure Communication Services Provider for sending emails through Azure API
|
|
5
|
-
*/
|
|
6
|
-
declare const azureProvider: ProviderFactory<AzureConfig, unknown, AzureEmailOptions>;
|
|
7
|
-
export default azureProvider;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Azure Communication Services configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface AzureConfig extends BaseConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Azure AD access token (for OAuth2 authentication)
|
|
8
|
-
*/
|
|
9
|
-
accessToken?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Azure Communication Services connection string or access token
|
|
12
|
-
*/
|
|
13
|
-
connectionString?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Azure Communication Services endpoint
|
|
16
|
-
* Defaults to: https://{region}.communication.azure.com
|
|
17
|
-
*/
|
|
18
|
-
endpoint?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Azure region (e.g., "eastus", "westus")
|
|
21
|
-
*/
|
|
22
|
-
region: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Azure-specific email options
|
|
26
|
-
*/
|
|
27
|
-
export interface AzureEmailOptions extends EmailOptions {
|
|
28
|
-
/**
|
|
29
|
-
* Custom headers
|
|
30
|
-
*/
|
|
31
|
-
headers?: Record<string, string>;
|
|
32
|
-
/**
|
|
33
|
-
* Importance level (normal, high)
|
|
34
|
-
*/
|
|
35
|
-
importance?: "normal" | "high";
|
|
36
|
-
/**
|
|
37
|
-
* Azure template ID for template-based emails
|
|
38
|
-
*/
|
|
39
|
-
templateId?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Template variables for Azure templates
|
|
42
|
-
*/
|
|
43
|
-
templateVariables?: Record<string, unknown>;
|
|
44
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { BrevoConfig, BrevoEmailOptions } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Brevo Provider for sending emails through Brevo API
|
|
5
|
-
*/
|
|
6
|
-
declare const brevoProvider: ProviderFactory<BrevoConfig, unknown, BrevoEmailOptions>;
|
|
7
|
-
export default brevoProvider;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailAddress, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Brevo configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface BrevoConfig extends BaseConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Brevo API key
|
|
8
|
-
*/
|
|
9
|
-
apiKey: string;
|
|
10
|
-
/**
|
|
11
|
-
* Brevo API endpoint
|
|
12
|
-
* Defaults to: https://api.brevo.com/v3
|
|
13
|
-
*/
|
|
14
|
-
endpoint?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Enable hard validation for replyTo addresses.
|
|
17
|
-
* If true, arrays will be rejected. If false, the first address from an array will be used.
|
|
18
|
-
* Defaults to: false
|
|
19
|
-
*/
|
|
20
|
-
hardValidation?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Brevo-specific email options
|
|
24
|
-
*/
|
|
25
|
-
export interface BrevoEmailOptions extends Omit<EmailOptions, "replyTo"> {
|
|
26
|
-
/**
|
|
27
|
-
* Batch ID for batch sending
|
|
28
|
-
*/
|
|
29
|
-
batchId?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Headers (custom headers)
|
|
32
|
-
*/
|
|
33
|
-
headers?: Record<string, string>;
|
|
34
|
-
/**
|
|
35
|
-
* Reply-to email address (can override base replyTo).
|
|
36
|
-
* Only one address is allowed. If an array is provided and hardValidation is false, the first address will be used.
|
|
37
|
-
*/
|
|
38
|
-
replyTo?: EmailAddress | EmailAddress[];
|
|
39
|
-
/**
|
|
40
|
-
* Scheduled date/time
|
|
41
|
-
* - If string: ISO 8601 format (e.g., "2025-01-15T10:00:00Z")
|
|
42
|
-
* - If number: Unix timestamp in seconds (not milliseconds)
|
|
43
|
-
*/
|
|
44
|
-
scheduledAt?: string | number;
|
|
45
|
-
/**
|
|
46
|
-
* Tags for categorization
|
|
47
|
-
*/
|
|
48
|
-
tags?: string[];
|
|
49
|
-
/**
|
|
50
|
-
* Brevo template ID for template-based emails
|
|
51
|
-
*/
|
|
52
|
-
templateId?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Template parameters for Brevo templates
|
|
55
|
-
*/
|
|
56
|
-
templateParams?: Record<string, unknown>;
|
|
57
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { FailoverConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Failover Provider for sending emails with automatic failover to backup providers.
|
|
5
|
-
*/
|
|
6
|
-
declare const provider: ProviderFactory<FailoverConfig>;
|
|
7
|
-
export default provider;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Failover configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface FailoverConfig extends BaseConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Array of provider instances or provider factories to use in failover order
|
|
8
|
-
* Can be Provider instances or ProviderFactory functions
|
|
9
|
-
*/
|
|
10
|
-
mailers: unknown[];
|
|
11
|
-
/**
|
|
12
|
-
* Time in milliseconds to wait before trying the next provider (default: 60)
|
|
13
|
-
*/
|
|
14
|
-
retryAfter?: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Failover-specific email options
|
|
18
|
-
*/
|
|
19
|
-
export type FailoverEmailOptions = EmailOptions;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { HttpEmailConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* HTTP Email Provider for sending emails via HTTP API.
|
|
5
|
-
*/
|
|
6
|
-
declare const httpProvider: ProviderFactory<HttpEmailConfig>;
|
|
7
|
-
export default httpProvider;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* HTTP email configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface HttpEmailConfig {
|
|
6
|
-
apiKey?: string;
|
|
7
|
-
endpoint: string;
|
|
8
|
-
headers?: Record<string, string>;
|
|
9
|
-
method?: "GET" | "POST" | "PUT";
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* HTTP-specific email options
|
|
13
|
-
*/
|
|
14
|
-
export interface HttpEmailOptions extends EmailOptions {
|
|
15
|
-
/**
|
|
16
|
-
* Custom parameters to include in the request payload
|
|
17
|
-
*/
|
|
18
|
-
customParams?: Record<string, unknown>;
|
|
19
|
-
/**
|
|
20
|
-
* Override the endpoint for this specific email
|
|
21
|
-
*/
|
|
22
|
-
endpointOverride?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Override the HTTP method for this specific email
|
|
25
|
-
*/
|
|
26
|
-
methodOverride?: "GET" | "POST" | "PUT";
|
|
27
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { InfobipConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Infobip Provider for sending emails through Infobip API
|
|
5
|
-
*/
|
|
6
|
-
declare const infobipProvider: ProviderFactory<InfobipConfig>;
|
|
7
|
-
export default infobipProvider;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Infobip configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface InfobipConfig extends BaseConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Infobip API key
|
|
8
|
-
*/
|
|
9
|
-
apiKey: string;
|
|
10
|
-
/**
|
|
11
|
-
* Infobip base URL (e.g., "https://api.infobip.com")
|
|
12
|
-
*/
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Infobip API endpoint
|
|
16
|
-
* Defaults to: https://{baseUrl}/email/3/send
|
|
17
|
-
*/
|
|
18
|
-
endpoint?: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Infobip-specific email options
|
|
22
|
-
*/
|
|
23
|
-
export interface InfobipEmailOptions extends EmailOptions {
|
|
24
|
-
/**
|
|
25
|
-
* Intermediate report (for delivery status updates)
|
|
26
|
-
*/
|
|
27
|
-
intermediateReport?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Notify URL (for delivery notifications)
|
|
30
|
-
*/
|
|
31
|
-
notifyUrl?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Send at (Unix timestamp in milliseconds)
|
|
34
|
-
*/
|
|
35
|
-
sendAt?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Infobip template ID for template-based emails
|
|
38
|
-
*/
|
|
39
|
-
templateId?: number;
|
|
40
|
-
/**
|
|
41
|
-
* Template variables for Infobip templates
|
|
42
|
-
*/
|
|
43
|
-
templateVariables?: Record<string, unknown>;
|
|
44
|
-
/**
|
|
45
|
-
* Tracking URL (for click tracking)
|
|
46
|
-
*/
|
|
47
|
-
trackingUrl?: string;
|
|
48
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { MailCrabConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* MailCrab Provider for local email testing
|
|
5
|
-
* MailCrab is a local SMTP server for testing emails during development
|
|
6
|
-
* This is a convenience wrapper around the SMTP provider with MailCrab defaults
|
|
7
|
-
*/
|
|
8
|
-
declare const mailCrabProvider: ProviderFactory<MailCrabConfig>;
|
|
9
|
-
export default mailCrabProvider;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* MailCrab configuration (for local development/testing)
|
|
4
|
-
*/
|
|
5
|
-
export interface MailCrabConfig extends BaseConfig {
|
|
6
|
-
/**
|
|
7
|
-
* MailCrab host (default: localhost)
|
|
8
|
-
*/
|
|
9
|
-
host?: string;
|
|
10
|
-
/**
|
|
11
|
-
* MailCrab port (default: 1025)
|
|
12
|
-
*/
|
|
13
|
-
port?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Use secure connection (default: false)
|
|
16
|
-
*/
|
|
17
|
-
secure?: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* MailCrab-specific email options
|
|
21
|
-
*/
|
|
22
|
-
export type MailCrabEmailOptions = EmailOptions;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { MailerSendConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* MailerSend Provider for sending emails through MailerSend API
|
|
5
|
-
*/
|
|
6
|
-
declare const mailerSendProvider: ProviderFactory<MailerSendConfig>;
|
|
7
|
-
export default mailerSendProvider;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { BaseConfig, EmailOptions } from "../../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* MailerSend configuration
|
|
4
|
-
*/
|
|
5
|
-
export interface MailerSendConfig extends BaseConfig {
|
|
6
|
-
/**
|
|
7
|
-
* MailerSend API token
|
|
8
|
-
*/
|
|
9
|
-
apiToken: string;
|
|
10
|
-
/**
|
|
11
|
-
* MailerSend API endpoint
|
|
12
|
-
* Defaults to: https://api.mailersend.com
|
|
13
|
-
*/
|
|
14
|
-
endpoint?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* MailerSend-specific email options
|
|
18
|
-
*/
|
|
19
|
-
export interface MailerSendEmailOptions extends EmailOptions {
|
|
20
|
-
/**
|
|
21
|
-
* Domain ID (optional, for domain-specific sending)
|
|
22
|
-
*/
|
|
23
|
-
domainId?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Personalization (per-recipient variables)
|
|
26
|
-
*/
|
|
27
|
-
personalization?: {
|
|
28
|
-
data: Record<string, unknown>;
|
|
29
|
-
email: string;
|
|
30
|
-
}[];
|
|
31
|
-
/**
|
|
32
|
-
* Scheduled at (Unix timestamp)
|
|
33
|
-
*/
|
|
34
|
-
scheduledAt?: number;
|
|
35
|
-
/**
|
|
36
|
-
* MailerSend template ID for template-based emails
|
|
37
|
-
*/
|
|
38
|
-
templateId?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Template variables for MailerSend templates
|
|
41
|
-
*/
|
|
42
|
-
templateVariables?: Record<string, unknown>;
|
|
43
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProviderFactory } from "../provider.d.ts";
|
|
2
|
-
import type { MailgunConfig } from "./types.d.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Mailgun Provider for sending emails through Mailgun API
|
|
5
|
-
*/
|
|
6
|
-
declare const mailgunProvider: ProviderFactory<MailgunConfig>;
|
|
7
|
-
export default mailgunProvider;
|