@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.
Files changed (138) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE.md +303 -483
  3. package/dist/crypto/index.d.ts +147 -4
  4. package/dist/index.d.ts +785 -9
  5. package/dist/packem_shared/provider.d-DcfYeGJJ.d.ts +28 -0
  6. package/dist/packem_shared/types.d-CNnnk-Ya.d.ts +102 -0
  7. package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
  8. package/dist/packem_shared/types.d-wwpgA3to.d.ts +204 -0
  9. package/dist/providers/ahasend/index.d.ts +36 -3
  10. package/dist/providers/aws-ses/index.d.ts +47 -3
  11. package/dist/providers/azure/index.d.ts +52 -3
  12. package/dist/providers/brevo/index.d.ts +65 -3
  13. package/dist/providers/failover/index.d.ts +27 -3
  14. package/dist/providers/http/index.d.ts +35 -3
  15. package/dist/providers/infobip/index.d.ts +56 -3
  16. package/dist/providers/mailcrab/index.d.ts +32 -3
  17. package/dist/providers/mailersend/index.d.ts +51 -3
  18. package/dist/providers/mailgun/index.d.ts +73 -3
  19. package/dist/providers/mailjet/index.d.ts +72 -3
  20. package/dist/providers/mailomat/index.d.ts +40 -3
  21. package/dist/providers/mailpace/index.d.ts +52 -3
  22. package/dist/providers/mailtrap/index.d.ts +44 -3
  23. package/dist/providers/mandrill/index.d.ts +87 -3
  24. package/dist/providers/mock/index.d.ts +59 -3
  25. package/dist/providers/nodemailer/index.d.ts +38 -3
  26. package/dist/providers/opentelemetry/index.d.ts +529 -3
  27. package/dist/providers/plunk/index.d.ts +38 -3
  28. package/dist/providers/postal/index.d.ts +48 -3
  29. package/dist/providers/postmark/index.d.ts +60 -3
  30. package/dist/providers/resend/index.d.ts +51 -3
  31. package/dist/providers/roundrobin/index.d.ts +27 -3
  32. package/dist/providers/scaleway/index.d.ts +44 -3
  33. package/dist/providers/sendgrid/index.d.ts +84 -3
  34. package/dist/providers/smtp/index.d.ts +71 -3
  35. package/dist/providers/sweego/index.d.ts +40 -3
  36. package/dist/providers/zeptomail/index.d.ts +37 -3
  37. package/dist/template-engines/handlebars.d.ts +23 -22
  38. package/dist/template-engines/html-to-text.d.ts +24 -24
  39. package/dist/template-engines/mjml.d.ts +10 -10
  40. package/dist/template-engines/react-email.d.ts +9 -9
  41. package/dist/template-engines/vue-email.d.ts +9 -9
  42. package/dist/utils/cache.d.ts +49 -48
  43. package/dist/utils/format-email-address.d.ts +8 -7
  44. package/dist/utils/normalize-email-aliases.d.ts +20 -20
  45. package/dist/utils/parse-address.d.ts +18 -17
  46. package/dist/utils/validation/check-mx-records.d.ts +36 -35
  47. package/dist/utils/validation/disposable-email-domains.d.ts +1 -13
  48. package/dist/utils/validation/role-accounts.d.ts +18 -18
  49. package/dist/utils/validation/validate-email.d.ts +5 -5
  50. package/dist/utils/validation/verify-email.d.ts +45 -42
  51. package/dist/utils/validation/verify-smtp.d.ts +35 -34
  52. package/package.json +37 -37
  53. package/dist/attachment-helpers.d.ts +0 -64
  54. package/dist/crypto/dkim-signer.d.ts +0 -48
  55. package/dist/crypto/smime-encrypter.d.ts +0 -53
  56. package/dist/crypto/smime-signer.d.ts +0 -48
  57. package/dist/crypto/types.d.ts +0 -101
  58. package/dist/draft-mail-message.d.ts +0 -13
  59. package/dist/errors/email-error.d.ts +0 -17
  60. package/dist/errors/required-option-error.d.ts +0 -10
  61. package/dist/mail-message.d.ts +0 -425
  62. package/dist/mail.d.ts +0 -206
  63. package/dist/providers/ahasend/provider.d.ts +0 -7
  64. package/dist/providers/ahasend/types.d.ts +0 -28
  65. package/dist/providers/aws-ses/provider.d.ts +0 -8
  66. package/dist/providers/aws-ses/types.d.ts +0 -38
  67. package/dist/providers/azure/provider.d.ts +0 -7
  68. package/dist/providers/azure/types.d.ts +0 -44
  69. package/dist/providers/brevo/provider.d.ts +0 -7
  70. package/dist/providers/brevo/types.d.ts +0 -57
  71. package/dist/providers/failover/provider.d.ts +0 -7
  72. package/dist/providers/failover/types.d.ts +0 -19
  73. package/dist/providers/http/provider.d.ts +0 -7
  74. package/dist/providers/http/types.d.ts +0 -27
  75. package/dist/providers/infobip/provider.d.ts +0 -7
  76. package/dist/providers/infobip/types.d.ts +0 -48
  77. package/dist/providers/mailcrab/provider.d.ts +0 -9
  78. package/dist/providers/mailcrab/types.d.ts +0 -22
  79. package/dist/providers/mailersend/provider.d.ts +0 -7
  80. package/dist/providers/mailersend/types.d.ts +0 -43
  81. package/dist/providers/mailgun/provider.d.ts +0 -7
  82. package/dist/providers/mailgun/types.d.ts +0 -65
  83. package/dist/providers/mailjet/provider.d.ts +0 -7
  84. package/dist/providers/mailjet/types.d.ts +0 -64
  85. package/dist/providers/mailomat/provider.d.ts +0 -7
  86. package/dist/providers/mailomat/types.d.ts +0 -32
  87. package/dist/providers/mailpace/provider.d.ts +0 -7
  88. package/dist/providers/mailpace/types.d.ts +0 -44
  89. package/dist/providers/mailtrap/provider.d.ts +0 -7
  90. package/dist/providers/mailtrap/types.d.ts +0 -36
  91. package/dist/providers/mandrill/provider.d.ts +0 -7
  92. package/dist/providers/mandrill/types.d.ts +0 -79
  93. package/dist/providers/mock/provider.d.ts +0 -8
  94. package/dist/providers/mock/types.d.ts +0 -50
  95. package/dist/providers/nodemailer/provider.d.ts +0 -7
  96. package/dist/providers/nodemailer/types.d.ts +0 -30
  97. package/dist/providers/opentelemetry/provider.d.ts +0 -7
  98. package/dist/providers/opentelemetry/types.d.ts +0 -31
  99. package/dist/providers/plunk/provider.d.ts +0 -7
  100. package/dist/providers/plunk/types.d.ts +0 -30
  101. package/dist/providers/postal/provider.d.ts +0 -7
  102. package/dist/providers/postal/types.d.ts +0 -40
  103. package/dist/providers/postmark/provider.d.ts +0 -7
  104. package/dist/providers/postmark/types.d.ts +0 -52
  105. package/dist/providers/provider.d.ts +0 -27
  106. package/dist/providers/resend/provider.d.ts +0 -7
  107. package/dist/providers/resend/types.d.ts +0 -43
  108. package/dist/providers/roundrobin/provider.d.ts +0 -7
  109. package/dist/providers/roundrobin/types.d.ts +0 -19
  110. package/dist/providers/scaleway/provider.d.ts +0 -7
  111. package/dist/providers/scaleway/types.d.ts +0 -36
  112. package/dist/providers/sendgrid/provider.d.ts +0 -7
  113. package/dist/providers/sendgrid/types.d.ts +0 -76
  114. package/dist/providers/smtp/provider.d.ts +0 -7
  115. package/dist/providers/smtp/types.d.ts +0 -63
  116. package/dist/providers/sweego/provider.d.ts +0 -7
  117. package/dist/providers/sweego/types.d.ts +0 -32
  118. package/dist/providers/utils/address-formatter.d.ts +0 -139
  119. package/dist/providers/utils/attachment-processor.d.ts +0 -58
  120. package/dist/providers/utils/index.d.ts +0 -4
  121. package/dist/providers/utils/payload-builder.d.ts +0 -78
  122. package/dist/providers/utils/provider-base.d.ts +0 -69
  123. package/dist/providers/zeptomail/provider.d.ts +0 -7
  124. package/dist/providers/zeptomail/types.d.ts +0 -29
  125. package/dist/template-engines/types.d.ts +0 -8
  126. package/dist/types.d.ts +0 -203
  127. package/dist/utils/build-mime-message.d.ts +0 -8
  128. package/dist/utils/create-logger.d.ts +0 -16
  129. package/dist/utils/format-email-addresses.d.ts +0 -8
  130. package/dist/utils/generate-boundary.d.ts +0 -7
  131. package/dist/utils/generate-message-id.d.ts +0 -6
  132. package/dist/utils/headers-to-record.d.ts +0 -9
  133. package/dist/utils/is-port-available.d.ts +0 -9
  134. package/dist/utils/make-request.d.ts +0 -18
  135. package/dist/utils/retry.d.ts +0 -10
  136. package/dist/utils/sanitize-header.d.ts +0 -14
  137. package/dist/utils/to-base64.d.ts +0 -8
  138. package/dist/utils/validation/validate-email-options.d.ts +0 -8
@@ -1,9 +1,10 @@
1
- import type { EmailAddress } from "../types.d.ts";
1
+ import { b as EmailAddress } from "../packem_shared/types.d-wwpgA3to.js";
2
+ import 'node:buffer';
2
3
  /**
3
- * Formats an email address as "Name <email@example.com>" or just "email@example.com" if no name is provided.
4
- * @param address The email address object to format.
5
- * @returns The formatted email address string in RFC 5322 format.
6
- * @throws {EmailError} When the email address is invalid.
7
- */
4
+ * Formats an email address as "Name <email@example.com>" or just "email@example.com" if no name is provided.
5
+ * @param address The email address object to format.
6
+ * @returns The formatted email address string in RFC 5322 format.
7
+ * @throws {EmailError} When the email address is invalid.
8
+ */
8
9
  declare const formatEmailAddress: (address: EmailAddress) => string;
9
- export default formatEmailAddress;
10
+ export { formatEmailAddress as default };
@@ -1,22 +1,22 @@
1
1
  /**
2
- * Normalizes email aliases for supported email providers.
3
- * For example: example@gmail.com and example+another@gmail.com point to the same email address.
4
- * This function normalizes aliases to their canonical form.
5
- *
6
- * Supported providers:
7
- * - Gmail: Removes dots and plus aliases (example+test@gmail.com → example@gmail.com)
8
- * - Yahoo, Outlook, Hotmail, Live, MSN, iCloud, ProtonMail, Zoho, FastMail, Mail.com, GMX: Removes plus aliases only
9
- * @param email The email address to normalize.
10
- * @returns The normalized email address, or the original email if not supported or invalid.
11
- * @example
12
- * ```ts
13
- * import { normalizeEmailAliases } from "@visulima/email/utils/normalize-email-aliases";
14
- *
15
- * normalizeEmailAliases("example+test@gmail.com"); // "example@gmail.com"
16
- * normalizeEmailAliases("ex.ample@gmail.com"); // "example@gmail.com"
17
- * normalizeEmailAliases("user+tag@yahoo.com"); // "user@yahoo.com"
18
- * normalizeEmailAliases("user@example.com"); // "user@example.com" (unchanged)
19
- * ```
20
- */
2
+ * Normalizes email aliases for supported email providers.
3
+ * For example: example@gmail.com and example+another@gmail.com point to the same email address.
4
+ * This function normalizes aliases to their canonical form.
5
+ *
6
+ * Supported providers:
7
+ * - Gmail: Removes dots and plus aliases (example+test@gmail.com → example@gmail.com)
8
+ * - Yahoo, Outlook, Hotmail, Live, MSN, iCloud, ProtonMail, Zoho, FastMail, Mail.com, GMX: Removes plus aliases only
9
+ * @param email The email address to normalize.
10
+ * @returns The normalized email address, or the original email if not supported or invalid.
11
+ * @example
12
+ * ```ts
13
+ * import { normalizeEmailAliases } from "@visulima/email/utils/normalize-email-aliases";
14
+ *
15
+ * normalizeEmailAliases("example+test@gmail.com"); // "example@gmail.com"
16
+ * normalizeEmailAliases("ex.ample@gmail.com"); // "example@gmail.com"
17
+ * normalizeEmailAliases("user+tag@yahoo.com"); // "user@yahoo.com"
18
+ * normalizeEmailAliases("user@example.com"); // "user@example.com" (unchanged)
19
+ * ```
20
+ */
21
21
  declare const normalizeEmailAliases: (email: string) => string;
22
- export default normalizeEmailAliases;
22
+ export { normalizeEmailAliases as default };
@@ -1,19 +1,20 @@
1
- import type { EmailAddress } from "../types.d.ts";
1
+ import { b as EmailAddress } from "../packem_shared/types.d-wwpgA3to.js";
2
+ import 'node:buffer';
2
3
  /**
3
- * Parses a string representation of an email address into an EmailAddress object.
4
- * Supports formats: "email@example.com", "Name <email@example.com>", "<email@example.com>".
5
- * @example Parsing an address with a name
6
- * ```ts
7
- * const address = parseAddress("John Doe <john@example.com>");
8
- * // { name: "John Doe", email: "john@example.com" }
9
- * ```
10
- * @example Parsing an address without a name
11
- * ```ts
12
- * const address = parseAddress("jane@example.com");
13
- * // { email: "jane@example.com" }
14
- * ```
15
- * @param address The string representation of the address to parse.
16
- * @returns An EmailAddress object if parsing is successful, or undefined if invalid.
17
- */
4
+ * Parses a string representation of an email address into an EmailAddress object.
5
+ * Supports formats: "email@example.com", "Name &lt;email@example.com>", "&lt;email@example.com>".
6
+ * @example Parsing an address with a name
7
+ * ```ts
8
+ * const address = parseAddress("John Doe <john@example.com>");
9
+ * // { name: "John Doe", email: "john@example.com" }
10
+ * ```
11
+ * @example Parsing an address without a name
12
+ * ```ts
13
+ * const address = parseAddress("jane@example.com");
14
+ * // { email: "jane@example.com" }
15
+ * ```
16
+ * @param address The string representation of the address to parse.
17
+ * @returns An EmailAddress object if parsing is successful, or undefined if invalid.
18
+ */
18
19
  declare const parseAddress: (address: string) => EmailAddress | undefined;
19
- export default parseAddress;
20
+ export { parseAddress as default };
@@ -1,42 +1,43 @@
1
- import type { Cache } from "../cache.d.ts";
2
- export type { Cache, InMemoryCache } from "../cache.d.ts";
1
+ import { Cache } from "../cache.js";
2
+ export { type InMemoryCache } from "../cache.js";
3
3
  /**
4
- * MX record information.
5
- */
6
- export interface MxRecord {
7
- exchange: string;
8
- priority: number;
4
+ * MX record information.
5
+ */
6
+ interface MxRecord {
7
+ exchange: string;
8
+ priority: number;
9
9
  }
10
10
  /**
11
- * Result of MX record check.
12
- */
13
- export interface MxCheckResult {
14
- error?: string;
15
- records?: MxRecord[];
16
- valid: boolean;
11
+ * Result of MX record check.
12
+ */
13
+ interface MxCheckResult {
14
+ error?: string;
15
+ records?: MxRecord[];
16
+ valid: boolean;
17
17
  }
18
18
  /**
19
- * Options for MX record checking.
20
- */
21
- export interface MxCheckOptions {
22
- cache?: Cache<MxCheckResult>;
23
- ttl?: number;
19
+ * Options for MX record checking.
20
+ */
21
+ interface MxCheckOptions {
22
+ cache?: Cache<MxCheckResult>;
23
+ ttl?: number;
24
24
  }
25
25
  /**
26
- * Checks MX records for a domain.
27
- * @param domain The domain to check MX records for.
28
- * @param options Options for MX record checking, including caching.
29
- * @returns Result containing MX records or error.
30
- * @example
31
- * ```ts
32
- * import { checkMxRecords } from "@visulima/email/validation/check-mx-records";
33
- * import { InMemoryCache } from "@visulima/email/utils/cache";
34
- *
35
- * const cache = new InMemoryCache();
36
- * const result = await checkMxRecords("example.com", { cache });
37
- * if (result.valid) {
38
- * console.log("MX records:", result.records);
39
- * }
40
- * ```
41
- */
42
- export declare const checkMxRecords: (domain: string, options?: MxCheckOptions) => Promise<MxCheckResult>;
26
+ * Checks MX records for a domain.
27
+ * @param domain The domain to check MX records for.
28
+ * @param options Options for MX record checking, including caching.
29
+ * @returns Result containing MX records or error.
30
+ * @example
31
+ * ```ts
32
+ * import { checkMxRecords } from "@visulima/email/validation/check-mx-records";
33
+ * import { InMemoryCache } from "@visulima/email/utils/cache";
34
+ *
35
+ * const cache = new InMemoryCache();
36
+ * const result = await checkMxRecords("example.com", { cache });
37
+ * if (result.valid) {
38
+ * console.log("MX records:", result.records);
39
+ * }
40
+ * ```
41
+ */
42
+ declare const checkMxRecords: (domain: string, options?: MxCheckOptions) => Promise<MxCheckResult>;
43
+ export { type Cache, MxCheckOptions, MxCheckResult, MxRecord, checkMxRecords };
@@ -1,13 +1 @@
1
- /**
2
- * Re-exports all functionality from @visulima/disposable-email-domains.
3
- * This provides access to disposable email domain checking utilities.
4
- * @example
5
- * ```ts
6
- * import { isDisposableEmail, isDisposableDomain, getDomainList } from "\@visulima/email/validation/disposable-email-domains";
7
- *
8
- * if (isDisposableEmail("user@mailinator.com")) {
9
- * console.log("Disposable email detected!");
10
- * }
11
- * ```
12
- */
13
- export * from "@visulima/disposable-email-domains";
1
+ export * from '@visulima/disposable-email-domains';
@@ -1,21 +1,21 @@
1
1
  /**
2
- * Common role account prefixes that indicate non-personal email addresses.
3
- * Includes RFC 2142 standard role accounts and common business/operational prefixes.
4
- */
2
+ * Common role account prefixes that indicate non-personal email addresses.
3
+ * Includes RFC 2142 standard role accounts and common business/operational prefixes.
4
+ */
5
5
  declare const ROLE_ACCOUNT_PREFIXES: Set<string>;
6
6
  /**
7
- * Checks if an email address is a role account (non-personal).
8
- * @param email The email address to check.
9
- * @param customPrefixes Optional set of additional role account prefixes.
10
- * @returns True if the email is a role account, false otherwise.
11
- * @example
12
- * ```ts
13
- * import { isRoleAccount } from "@visulima/email/validation/role-accounts";
14
- *
15
- * if (isRoleAccount("noreply@example.com")) {
16
- * console.log("This is a role account");
17
- * }
18
- * ```
19
- */
20
- export declare const isRoleAccount: (email: string, customPrefixes?: Set<string>) => boolean;
21
- export { ROLE_ACCOUNT_PREFIXES };
7
+ * Checks if an email address is a role account (non-personal).
8
+ * @param email The email address to check.
9
+ * @param customPrefixes Optional set of additional role account prefixes.
10
+ * @returns True if the email is a role account, false otherwise.
11
+ * @example
12
+ * ```ts
13
+ * import { isRoleAccount } from "@visulima/email/validation/role-accounts";
14
+ *
15
+ * if (isRoleAccount("noreply@example.com")) {
16
+ * console.log("This is a role account");
17
+ * }
18
+ * ```
19
+ */
20
+ declare const isRoleAccount: (email: string, customPrefixes?: Set<string>) => boolean;
21
+ export { ROLE_ACCOUNT_PREFIXES, isRoleAccount };
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Validates an email address format according to basic RFC standards.
3
- * @param email The email address string to validate.
4
- * @returns True if the email address is valid, false otherwise.
5
- */
2
+ * Validates an email address format according to basic RFC standards.
3
+ * @param email The email address string to validate.
4
+ * @returns True if the email address is valid, false otherwise.
5
+ */
6
6
  declare const validateEmail: (email: string) => boolean;
7
- export default validateEmail;
7
+ export { validateEmail as default };
@@ -1,47 +1,50 @@
1
- import type { SmtpVerificationOptions } from "./verify-smtp.d.ts";
1
+ import { SmtpVerificationOptions } from "./verify-smtp.js";
2
+ import "../cache.js";
3
+ import "./check-mx-records.js";
2
4
  /**
3
- * Options for comprehensive email verification.
4
- */
5
- export interface EmailVerificationOptions extends SmtpVerificationOptions {
6
- checkDisposable?: boolean;
7
- checkMx?: boolean;
8
- checkRoleAccount?: boolean;
9
- checkSmtp?: boolean;
10
- customDisposableDomains?: Set<string>;
11
- customRolePrefixes?: Set<string>;
5
+ * Options for comprehensive email verification.
6
+ */
7
+ interface EmailVerificationOptions extends SmtpVerificationOptions {
8
+ checkDisposable?: boolean;
9
+ checkMx?: boolean;
10
+ checkRoleAccount?: boolean;
11
+ checkSmtp?: boolean;
12
+ customDisposableDomains?: Set<string>;
13
+ customRolePrefixes?: Set<string>;
12
14
  }
13
15
  /**
14
- * Result of comprehensive email verification.
15
- */
16
- export interface EmailVerificationResult {
17
- disposable?: boolean;
18
- errors: string[];
19
- formatValid: boolean;
20
- mxValid?: boolean;
21
- roleAccount?: boolean;
22
- smtpValid?: boolean;
23
- valid: boolean;
24
- warnings: string[];
16
+ * Result of comprehensive email verification.
17
+ */
18
+ interface EmailVerificationResult {
19
+ disposable?: boolean;
20
+ errors: string[];
21
+ formatValid: boolean;
22
+ mxValid?: boolean;
23
+ roleAccount?: boolean;
24
+ smtpValid?: boolean;
25
+ valid: boolean;
26
+ warnings: string[];
25
27
  }
26
28
  /**
27
- * Comprehensive email verification combining multiple checks.
28
- * @param email The email address to verify.
29
- * @param options Verification options.
30
- * @returns Detailed verification result.
31
- * @example
32
- * ```ts
33
- * import { verifyEmail } from "@visulima/email/validation/verify-email";
34
- *
35
- * const result = await verifyEmail("user@example.com", {
36
- * checkDisposable: true,
37
- * checkRoleAccount: true,
38
- * checkMx: true,
39
- * checkSmtp: false
40
- * });
41
- *
42
- * if (result.valid) {
43
- * console.log("Email is valid!");
44
- * }
45
- * ```
46
- */
47
- export declare const verifyEmail: (email: string, options?: EmailVerificationOptions) => Promise<EmailVerificationResult>;
29
+ * Comprehensive email verification combining multiple checks.
30
+ * @param email The email address to verify.
31
+ * @param options Verification options.
32
+ * @returns Detailed verification result.
33
+ * @example
34
+ * ```ts
35
+ * import { verifyEmail } from "@visulima/email/validation/verify-email";
36
+ *
37
+ * const result = await verifyEmail("user@example.com", {
38
+ * checkDisposable: true,
39
+ * checkRoleAccount: true,
40
+ * checkMx: true,
41
+ * checkSmtp: false
42
+ * });
43
+ *
44
+ * if (result.valid) {
45
+ * console.log("Email is valid!");
46
+ * }
47
+ * ```
48
+ */
49
+ declare const verifyEmail: (email: string, options?: EmailVerificationOptions) => Promise<EmailVerificationResult>;
50
+ export { EmailVerificationOptions, EmailVerificationResult, verifyEmail };
@@ -1,39 +1,40 @@
1
- import type { Cache } from "../cache.d.ts";
2
- import type { MxCheckResult, MxRecord } from "./check-mx-records.d.ts";
1
+ import { Cache } from "../cache.js";
2
+ import { MxCheckResult, MxRecord } from "./check-mx-records.js";
3
3
  /**
4
- * Options for SMTP verification.
5
- */
6
- export interface SmtpVerificationOptions {
7
- cache?: Cache<MxCheckResult>;
8
- fromEmail?: string;
9
- port?: number;
10
- smtpCache?: Cache<SmtpVerificationResult>;
11
- timeout?: number;
12
- ttl?: number;
4
+ * Options for SMTP verification.
5
+ */
6
+ interface SmtpVerificationOptions {
7
+ cache?: Cache<MxCheckResult>;
8
+ fromEmail?: string;
9
+ port?: number;
10
+ smtpCache?: Cache<SmtpVerificationResult>;
11
+ timeout?: number;
12
+ ttl?: number;
13
13
  }
14
14
  /**
15
- * Detailed result of SMTP verification attempt.
16
- */
17
- export interface SmtpVerificationResult {
18
- error?: string;
19
- mxRecords?: MxRecord[];
20
- smtpResponse?: string;
21
- valid: boolean;
15
+ * Detailed result of SMTP verification attempt.
16
+ */
17
+ interface SmtpVerificationResult {
18
+ error?: string;
19
+ mxRecords?: MxRecord[];
20
+ smtpResponse?: string;
21
+ valid: boolean;
22
22
  }
23
23
  /**
24
- * Verifies an email address by checking MX records and attempting SMTP verification.
25
- * Note: Many mail servers block SMTP verification to prevent email harvesting.
26
- * @param email The email address to verify.
27
- * @param options Verification options.
28
- * @returns Result containing verification status.
29
- * @example
30
- * ```ts
31
- * import { verifySmtp } from "@visulima/email/validation/verify-smtp";
32
- *
33
- * const result = await verifySmtp("user@example.com", {
34
- * timeout: 5000,
35
- * fromEmail: "test@example.com"
36
- * });
37
- * ```
38
- */
39
- export declare const verifySmtp: (email: string, options?: SmtpVerificationOptions) => Promise<SmtpVerificationResult>;
24
+ * Verifies an email address by checking MX records and attempting SMTP verification.
25
+ * Note: Many mail servers block SMTP verification to prevent email harvesting.
26
+ * @param email The email address to verify.
27
+ * @param options Verification options.
28
+ * @returns Result containing verification status.
29
+ * @example
30
+ * ```ts
31
+ * import { verifySmtp } from "@visulima/email/validation/verify-smtp";
32
+ *
33
+ * const result = await verifySmtp("user@example.com", {
34
+ * timeout: 5000,
35
+ * fromEmail: "test@example.com"
36
+ * });
37
+ * ```
38
+ */
39
+ declare const verifySmtp: (email: string, options?: SmtpVerificationOptions) => Promise<SmtpVerificationResult>;
40
+ export { SmtpVerificationOptions, SmtpVerificationResult, verifySmtp };
package/package.json CHANGED
@@ -1,52 +1,52 @@
1
1
  {
2
2
  "name": "@visulima/email",
3
- "version": "1.0.0-alpha.16",
3
+ "version": "1.0.0-alpha.18",
4
4
  "description": "A comprehensive email library with multi-provider support, crypto utilities, and template engines",
5
5
  "keywords": [
6
- "visulima",
7
- "email",
8
- "mail",
9
- "better-mail",
10
- "smtp",
11
- "resend",
6
+ "ahasend",
12
7
  "aws-ses",
13
- "zeptomail",
14
- "http",
8
+ "azure",
9
+ "better-mail",
10
+ "brevo",
11
+ "crypto",
12
+ "disposable-email",
13
+ "disposable-email-domains",
14
+ "dkim",
15
+ "email",
16
+ "encryption",
15
17
  "failover",
16
- "roundrobin",
18
+ "handlebars",
19
+ "html-to-text",
20
+ "http",
21
+ "infobip",
22
+ "mail",
17
23
  "mailcrab",
18
- "nodemailer",
19
- "opentelemetry",
20
- "plunk",
21
- "mock",
22
- "sendgrid",
24
+ "mailersend",
23
25
  "mailgun",
24
- "postmark",
25
- "brevo",
26
26
  "mailjet",
27
- "mailersend",
27
+ "mailomat",
28
+ "mailpace",
29
+ "mailtrap",
28
30
  "mandrill",
31
+ "mjml",
32
+ "mock",
33
+ "nodemailer",
34
+ "opentelemetry",
35
+ "plunk",
29
36
  "postal",
30
- "mailtrap",
31
- "mailpace",
32
- "azure",
33
- "infobip",
37
+ "postmark",
38
+ "react-email",
39
+ "resend",
40
+ "roundrobin",
34
41
  "scaleway",
35
- "ahasend",
36
- "mailomat",
37
- "sweego",
38
- "dkim",
39
- "smime",
40
- "encryption",
42
+ "sendgrid",
41
43
  "signing",
42
- "crypto",
43
- "disposable-email",
44
- "disposable-email-domains",
45
- "handlebars",
46
- "mjml",
47
- "react-email",
44
+ "smime",
45
+ "smtp",
46
+ "sweego",
47
+ "visulima",
48
48
  "vue-email",
49
- "html-to-text"
49
+ "zeptomail"
50
50
  ],
51
51
  "homepage": "https://visulima.com/packages/email",
52
52
  "bugs": {
@@ -271,11 +271,11 @@
271
271
  },
272
272
  "peerDependencies": {
273
273
  "@opentelemetry/api": "^1.0.0 || ^2.0.0",
274
- "@react-email/render": "^2.0.7",
274
+ "@react-email/render": "^2.0.8",
275
275
  "@vue-email/render": "0.0.9",
276
276
  "asn1js": "3.0.10",
277
277
  "handlebars": "4.7.9",
278
- "mjml": "5.0.1",
278
+ "mjml": "5.1.0",
279
279
  "nodemailer": ">=7",
280
280
  "pkijs": "3.4.0"
281
281
  },
@@ -1,64 +0,0 @@
1
- import type { Buffer } from "node:buffer";
2
- /**
3
- * Detects MIME type from filename using mime package.
4
- * Falls back to application/octet-stream if not found.
5
- * @param filename The filename or path.
6
- * @returns MIME type or application/octet-stream as fallback.
7
- */
8
- export declare const detectMimeType: (filename: string) => string;
9
- /**
10
- * Generates a Content-ID for inline attachments.
11
- * @param filename The filename to generate CID from.
12
- * @returns A unique Content-ID string.
13
- */
14
- export declare const generateContentId: (filename: string) => string;
15
- /**
16
- * Reads file and returns its content as Buffer.
17
- * @param filePath Path to the file.
18
- * @returns Buffer containing file content.
19
- */
20
- export declare const readFileAsBuffer: (filePath: string) => Promise<Buffer>;
21
- /**
22
- * Attachment options for helper methods
23
- */
24
- export interface AttachmentOptions {
25
- /**
26
- * Content-ID for inline attachments (used in HTML with cid:).
27
- * If not provided and contentDisposition is 'inline', will be auto-generated.
28
- */
29
- cid?: string;
30
- /**
31
- * Content disposition type.
32
- * 'attachment' (default) or 'inline'.
33
- */
34
- contentDisposition?: "attachment" | "inline";
35
- /**
36
- * MIME type of the attachment.
37
- * If not provided, will be detected from filename.
38
- */
39
- contentType?: string;
40
- /**
41
- * Content transfer encoding.
42
- * Examples: 'base64', '7bit', 'quoted-printable'.
43
- */
44
- encoding?: string;
45
- /**
46
- * Custom filename.
47
- * Used when different from the file path.
48
- */
49
- filename?: string;
50
- /**
51
- * Custom headers for this attachment.
52
- */
53
- headers?: Record<string, string>;
54
- }
55
- /**
56
- * Attachment data options (for raw data attachments)
57
- */
58
- export interface AttachmentDataOptions extends AttachmentOptions {
59
- /**
60
- * Filename for the attachment.
61
- * Required for raw data attachments.
62
- */
63
- filename: string;
64
- }
@@ -1,48 +0,0 @@
1
- import type { EmailOptions } from "../types.d.ts";
2
- import type { DkimOptions, EmailSigner } from "./types.d.ts";
3
- /**
4
- * DKIM signer implementation
5
- */
6
- export declare class DkimSigner implements EmailSigner {
7
- /**
8
- * Sanitizes a display name for use in quoted email headers per RFC 5322.
9
- * Removes/replaces CR, LF, tabs with space, escapes backslashes and quotes,
10
- * and strips non-printable control characters.
11
- * @param name The display name to sanitize.
12
- * @returns The sanitized display name, or empty string if nothing remains.
13
- */
14
- private static sanitizeDisplayName;
15
- /**
16
- * Formats an email address for use in email headers.
17
- * @param address The email address object to format.
18
- * @param address.email The email address string.
19
- * @param address.name Optional display name for the email address.
20
- * @returns The formatted email address string in RFC 5322 format.
21
- */
22
- private static formatAddress;
23
- /**
24
- * Formats email addresses for headers.
25
- * @param addresses The email address(es) to format (single or array).
26
- * @returns The formatted email addresses string (comma-separated if multiple).
27
- */
28
- private static formatAddresses;
29
- private readonly options;
30
- /**
31
- * Creates a new DKIM signer.
32
- * @param options DKIM signing options.
33
- */
34
- constructor(options: DkimOptions);
35
- /**
36
- * Signs an email message with DKIM.
37
- * @param email The email options to sign.
38
- * @returns The email options with DKIM signature header added.
39
- * @throws {Error} When signing fails (e.g., invalid private key).
40
- */
41
- sign(email: EmailOptions): Promise<EmailOptions>;
42
- }
43
- /**
44
- * Creates a DKIM signer instance.
45
- * @param options DKIM signing options.
46
- * @returns A new DkimSigner instance.
47
- */
48
- export declare const createDkimSigner: (options: DkimOptions) => DkimSigner;