emailr 1.11.0 → 1.12.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.
package/dist/index.js CHANGED
@@ -226,7 +226,12 @@ var EmailsResource = class {
226
226
  * Send an email to one or multiple recipients
227
227
  */
228
228
  async send(data) {
229
- return this.http.post("/v1/emails/send", data);
229
+ const payload = { ...data };
230
+ if (payload.from_name && payload.from && !payload.from.includes("<")) {
231
+ payload.from = `${payload.from_name} <${payload.from}>`;
232
+ }
233
+ delete payload.from_name;
234
+ return this.http.post("/v1/emails/send", payload);
230
235
  }
231
236
  /**
232
237
  * Get email by ID
package/dist/index.mjs CHANGED
@@ -193,7 +193,12 @@ var EmailsResource = class {
193
193
  * Send an email to one or multiple recipients
194
194
  */
195
195
  async send(data) {
196
- return this.http.post("/v1/emails/send", data);
196
+ const payload = { ...data };
197
+ if (payload.from_name && payload.from && !payload.from.includes("<")) {
198
+ payload.from = `${payload.from_name} <${payload.from}>`;
199
+ }
200
+ delete payload.from_name;
201
+ return this.http.post("/v1/emails/send", payload);
197
202
  }
198
203
  /**
199
204
  * Get email by ID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emailr",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Official Emailr API SDK for TypeScript/JavaScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -15,11 +15,6 @@
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
- "scripts": {
19
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
20
- "test": "vitest run",
21
- "typecheck": "tsc --noEmit"
22
- },
23
18
  "keywords": [
24
19
  "emailr",
25
20
  "email",
@@ -36,5 +31,10 @@
36
31
  },
37
32
  "engines": {
38
33
  "node": ">=18.0.0"
34
+ },
35
+ "scripts": {
36
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
37
+ "test": "vitest run",
38
+ "typecheck": "tsc --noEmit"
39
39
  }
40
- }
40
+ }