mailchannels-sdk 1.4.0 → 1.5.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.
|
@@ -86,6 +86,19 @@ 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 differs from the domain you pass as `domain`, provide
|
|
92
|
+
it as `envelopeFromDomain` so SPF and Domain Lockdown are evaluated against the
|
|
93
|
+
correct domain — otherwise SPF or Domain Lockdown failures may cause message delivery
|
|
94
|
+
to fail.
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
const { data, error } = await mc.domains.check('example.com', {
|
|
98
|
+
envelopeFromDomain: 'bounce.example.net'
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
89
102
|
## Verdicts Reference
|
|
90
103
|
|
|
91
104
|
- 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.
|
|
12
|
+
> Built and tested against Email API `1.7.1`
|
|
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://
|
|
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
|
|
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
|
|
891
|
+
interface DomainsCheckDkim {
|
|
892
892
|
/**
|
|
893
893
|
* Domain used for DKIM signing.
|
|
894
894
|
*/
|
|
@@ -912,9 +912,16 @@ 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?:
|
|
915
|
+
dkim?: DomainsCheckDkim[] | DomainsCheckDkim;
|
|
916
916
|
/**
|
|
917
|
-
*
|
|
917
|
+
* Optional envelope-from domain. During message delivery, SPF and Domain Lockdown verification are evaluated
|
|
918
|
+
* against the envelope sender domain. If your envelope-from domain differs from the domain used for sending
|
|
919
|
+
* messages, provide it here to ensure both checks are run against the correct domain. Otherwise, SPF or Domain
|
|
920
|
+
* Lockdown failures may cause message delivery to fail.
|
|
921
|
+
*/
|
|
922
|
+
envelopeFromDomain?: string;
|
|
923
|
+
/**
|
|
924
|
+
* 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
925
|
*/
|
|
919
926
|
senderId?: string;
|
|
920
927
|
}
|
|
@@ -941,7 +948,7 @@ type DomainsCheckResponse = DataResponse<{
|
|
|
941
948
|
verdict: Extract<DomainsCheckVerdict, "passed" | "failed">;
|
|
942
949
|
};
|
|
943
950
|
/**
|
|
944
|
-
* These results are here to help avoid [SDNF](https://
|
|
951
|
+
* 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
952
|
*/
|
|
946
953
|
senderDomain: {
|
|
947
954
|
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.
|
|
6
|
+
var version = "1.5.1";
|
|
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.
|
|
3
|
+
"version": "1.5.1",
|
|
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",
|
|
@@ -51,20 +51,20 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
54
|
-
"@types/markdown-it": "^14.
|
|
54
|
+
"@types/markdown-it": "^14.2.0",
|
|
55
55
|
"@types/node": "^26.2.0",
|
|
56
56
|
"@types/nodemailer": "^8.0.1",
|
|
57
|
-
"@vitest/coverage-v8": "^4.1.
|
|
57
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
58
58
|
"changelogen": "^0.6.2",
|
|
59
59
|
"nodemailer": "^9.0.5",
|
|
60
60
|
"obuild": "^0.4.38",
|
|
61
|
-
"oxlint": "^1.
|
|
61
|
+
"oxlint": "^1.79.0",
|
|
62
62
|
"scule": "^1.3.0",
|
|
63
63
|
"typescript": "^6.0.3",
|
|
64
64
|
"vitepress": "^2.0.0-alpha.19",
|
|
65
65
|
"vitepress-plugin-group-icons": "^1.7.6",
|
|
66
66
|
"vitepress-plugin-llms": "^1.13.5",
|
|
67
|
-
"vitest": "^4.1.
|
|
67
|
+
"vitest": "^4.1.11"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=20"
|