mailchannels-sdk 1.4.0 → 1.5.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.
@@ -86,6 +86,18 @@ const { data, error } = await mc.domains.check('example.com', {
86
86
 
87
87
  If your lockdown record uses `auth=` (account-wide authorization), omit `senderId`.
88
88
 
89
+ ## With A Different Envelope-From Domain
90
+
91
+ If the envelope-from domain used during delivery differs from the domain you are
92
+ checking, provide it with `envelopeFromDomain` so SPF is evaluated against the
93
+ correct domain:
94
+
95
+ ```ts
96
+ const { data, error } = await mc.domains.check('example.com', {
97
+ envelopeFromDomain: 'bounce.example.net'
98
+ })
99
+ ```
100
+
89
101
  ## Verdicts Reference
90
102
 
91
103
  - DKIM, Domain Lockdown, A, and MX verdicts: `'passed'` or `'failed'`.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  [![TypeScript][typescript-src]][typescript-href]
10
10
  [![Node.js][node-src]][node-href]
11
11
 
12
- > Built and tested against Email API `1.6.0`
12
+ > Built and tested against Email API `1.7.0`
13
13
 
14
14
  Node.js SDK to integrate [MailChannels Email API](https://docs.mailchannels.com/email-api) into your JavaScript or TypeScript server-side applications.
15
15
 
@@ -57,7 +57,7 @@ Some of the things you can do with the SDK:
57
57
  ## <a name="prerequisites">📏 Prerequisites</a>
58
58
 
59
59
  - [Create a MailChannels account](https://www.mailchannels.com/pricing/#for_devs)
60
- - [Create an API key](https://console.mailchannels.net/settings/accountSettings#APIKeys)
60
+ - [Create an API key](https://dash.mailchannels.com/account/api-keys)
61
61
 
62
62
  ## <a name="installation">📦 Installation</a>
63
63
 
@@ -475,7 +475,7 @@ type EmailsSendResponse = DataResponse<{
475
475
  /**
476
476
  * The index of the personalization in the request. Starts at 0.
477
477
  */
478
- index?: number;
478
+ index: number;
479
479
  /**
480
480
  * The Message ID is a unique identifier generated by the service. Each personalization has a distinct Message ID, which is also used in the `Message-Id` header and included in webhooks.
481
481
  */
@@ -888,7 +888,7 @@ declare class DomainsCustomTracking {
888
888
  */
889
889
  delete(hostname: string, scope: DomainsCustomTrackingScope): Promise<SuccessResponse>;
890
890
  }
891
- interface DomainsCheck {
891
+ interface DomainsCheckDkim {
892
892
  /**
893
893
  * Domain used for DKIM signing.
894
894
  */
@@ -912,9 +912,15 @@ interface DomainsCheckOptions {
912
912
  * 5. If `privateKey` is present, `selector` must be present.
913
913
  * 6. If `selector` is present and `domain` is not, the domain will be taken from the domain field of the request.
914
914
  */
915
- dkim?: DomainsCheck[] | DomainsCheck;
915
+ dkim?: DomainsCheckDkim[] | DomainsCheckDkim;
916
916
  /**
917
- * Used exclusively for [Domain Lockdown](https://support.mailchannels.com/hc/en-us/articles/16918954360845-Secure-your-domain-name-against-spoofing-with-Domain-Lockdown) verification. If you're not using senderid to associate your domain with your account, you can disregard this field. The corresponding value is included in the `X-MailChannels-SenderId` header of emails sent via MailChannels.
917
+ * Optional envelope-from domain. During message delivery, SPF is evaluated against the envelope sender domain.
918
+ * If your envelope-from domain differs from the domain used for sending messages, provide it here to ensure SPF
919
+ * is checked against the correct domain. Otherwise, SPF failures may cause recipient servers to reject messages.
920
+ */
921
+ envelopeFromDomain?: string;
922
+ /**
923
+ * Used exclusively for [Domain Lockdown](https://docs.mailchannels.com/email-api/domain-lockdown) verification. If you're not using senderid to associate your domain with your account, you can disregard this field. The corresponding value is included in the `X-MailChannels-SenderId` header of emails sent via MailChannels.
918
924
  */
919
925
  senderId?: string;
920
926
  }
@@ -941,7 +947,7 @@ type DomainsCheckResponse = DataResponse<{
941
947
  verdict: Extract<DomainsCheckVerdict, "passed" | "failed">;
942
948
  };
943
949
  /**
944
- * These results are here to help avoid [SDNF](https://support.mailchannels.com/hc/en-us/articles/203155500-550-5-2-1-SDNF-Sender-Domain-Not-Found) (Sender Domain Not Found) blocks. For messages not to get blocked by SDNF, we require either an MX or A record to exist for the sender domain.
950
+ * These results are here to help avoid [SDNF](https://docs.mailchannels.com/email-api/troubleshooting#550-5-1-2-sdnf-sender-domain-not-found) (Sender Domain Not Found) blocks. For messages not to get blocked by SDNF, we require either an MX or A record to exist for the sender domain.
945
951
  */
946
952
  senderDomain: {
947
953
  a: {
@@ -3,7 +3,7 @@ import { subtle } from "node:crypto";
3
3
  import { Buffer } from "node:buffer";
4
4
  import mime from "mime";
5
5
  var name = "mailchannels-sdk";
6
- var version = "1.4.0";
6
+ var version = "1.5.0";
7
7
  var MailChannelsClient = class MailChannelsClient {
8
8
  static DEFAULT_BASE_URL = "https://api.mailchannels.net";
9
9
  static DEFAULT_TIMEOUT = 12e4;
@@ -904,6 +904,7 @@ var Domains = class {
904
904
  dkim_selector: dkim.selector
905
905
  })),
906
906
  domain,
907
+ envelope_from_domain: options?.envelopeFromDomain,
907
908
  sender_id: options?.senderId
908
909
  };
909
910
  const response = await this.mailchannels.post("/tx/v1/check-domain", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailchannels-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Node.js SDK to integrate MailChannels Email API into your JavaScript or TypeScript server-side applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",