dx-mail 1.0.3 → 1.0.4

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 (2) hide show
  1. package/README.md +33 -46
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@ Fast temporary email client with realtime inbox updates.
8
8
 
9
9
  DX Mail lets you create temporary email inboxes, listen for incoming messages instantly, and integrate them into bots, dashboards, automation tools, or Node.js apps.
10
10
 
11
- Perfect for Telegram bots, WhatsApp bots, web inboxes, OTP listeners, verification flows, testing tools, and custom mail automation.
11
+ No server URL setup needed. Just install, authenticate, create an inbox, and listen for incoming emails. Tiny client, realtime inbox, big mailbox energy.
12
12
 
13
13
  ---
14
14
 
@@ -20,7 +20,7 @@ Perfect for Telegram bots, WhatsApp bots, web inboxes, OTP listeners, verificati
20
20
  - 📥 Read message history
21
21
  - 🌐 Supports plain text and HTML emails
22
22
  - 🤖 Works great with Telegram and WhatsApp bots
23
- - 🧩 Simple API, similar feeling to Express-style clients
23
+ - 🧩 Simple and friendly API
24
24
  - 🔑 API key authentication
25
25
  - 📦 Lightweight Node.js client
26
26
 
@@ -39,10 +39,9 @@ npm install dx-mail
39
39
  ```js
40
40
  const dxMail = require("dx-mail");
41
41
 
42
- const app = dxMail({
43
- baseUrl: "https://your-server.com",
44
- token: "dxm_your_api_key"
45
- });
42
+ const app = dxMail();
43
+
44
+ app.auth("dxm_your_api_key");
46
45
 
47
46
  async function main() {
48
47
  const res = await app.createMail();
@@ -64,26 +63,22 @@ m7fa8d3c21a@yourdomain.com
64
63
 
65
64
  ## 🔐 Authentication
66
65
 
67
- You can pass your API key directly when creating the client.
66
+ Authenticate using your DX Mail API key.
68
67
 
69
68
  ```js
70
69
  const dxMail = require("dx-mail");
71
70
 
72
- const app = dxMail({
73
- baseUrl: "https://your-server.com",
74
- token: "dxm_your_api_key"
75
- });
71
+ const app = dxMail();
72
+
73
+ app.auth("dxm_your_api_key");
76
74
  ```
77
75
 
78
- Or use the chained style.
76
+ You can also pass the token directly.
79
77
 
80
78
  ```js
81
79
  const dxMail = require("dx-mail");
82
80
 
83
- const app = dxMail();
84
-
85
- app.setBaseUrl("https://your-server.com");
86
- app.auth("dxm_your_api_key");
81
+ const app = dxMail("dxm_your_api_key");
87
82
  ```
88
83
 
89
84
  ---
@@ -299,10 +294,9 @@ For web inboxes, sanitize HTML before rendering it to users.
299
294
  ```js
300
295
  const dxMail = require("dx-mail");
301
296
 
302
- const app = dxMail({
303
- baseUrl: "https://your-server.com",
304
- token: "dxm_your_api_key"
305
- });
297
+ const app = dxMail();
298
+
299
+ app.auth("dxm_your_api_key");
306
300
 
307
301
  async function createUserMail(ctx) {
308
302
  const res = await app.createMail();
@@ -324,10 +318,9 @@ async function createUserMail(ctx) {
324
318
  ```js
325
319
  const dxMail = require("dx-mail");
326
320
 
327
- const app = dxMail({
328
- baseUrl: "https://your-server.com",
329
- token: "dxm_your_api_key"
330
- });
321
+ const app = dxMail();
322
+
323
+ app.auth("dxm_your_api_key");
331
324
 
332
325
  async function createWhatsAppMail(sock, jid) {
333
326
  const res = await app.createMail();
@@ -355,10 +348,9 @@ async function createWhatsAppMail(sock, jid) {
355
348
  ```js
356
349
  const dxMail = require("dx-mail");
357
350
 
358
- const app = dxMail({
359
- baseUrl: "https://your-server.com",
360
- token: "dxm_your_api_key"
361
- });
351
+ const app = dxMail();
352
+
353
+ app.auth("dxm_your_api_key");
362
354
 
363
355
  app.watchMail("test1", (event) => {
364
356
  renderMessage(event.message);
@@ -374,31 +366,28 @@ function renderMessage(message) {
374
366
 
375
367
  ## 🧠 API Reference
376
368
 
377
- ### `dxMail(options)`
369
+ ### `dxMail()`
378
370
 
379
371
  Create a new DX Mail client.
380
372
 
381
373
  ```js
382
- const app = dxMail({
383
- baseUrl: "https://your-server.com",
384
- token: "dxm_your_api_key"
385
- });
374
+ const app = dxMail();
386
375
  ```
387
376
 
388
- ### `app.auth(token)`
377
+ ### `dxMail(token)`
389
378
 
390
- Set or update the API key.
379
+ Create a new client and set the API key immediately.
391
380
 
392
381
  ```js
393
- app.auth("dxm_your_api_key");
382
+ const app = dxMail("dxm_your_api_key");
394
383
  ```
395
384
 
396
- ### `app.setBaseUrl(url)`
385
+ ### `app.auth(token)`
397
386
 
398
- Set the DX Mail server URL.
387
+ Set or update the API key.
399
388
 
400
389
  ```js
401
- app.setBaseUrl("https://your-server.com");
390
+ app.auth("dxm_your_api_key");
402
391
  ```
403
392
 
404
393
  ### `app.createMail(name?)`
@@ -504,12 +493,11 @@ app.close();
504
493
 
505
494
  ---
506
495
 
507
- ## ⚙️ Environment Variables
496
+ ## ⚙️ Environment Variable
508
497
 
509
- You can also configure the client using environment variables.
498
+ You can also set your token using an environment variable.
510
499
 
511
500
  ```bash
512
- DX_MAIL_BASE_URL=https://your-server.com
513
501
  DX_MAIL_TOKEN=dxm_your_api_key
514
502
  ```
515
503
 
@@ -531,10 +519,9 @@ console.log(res.inbox.address);
531
519
  ```js
532
520
  const dxMail = require("dx-mail");
533
521
 
534
- const app = dxMail({
535
- baseUrl: "https://your-server.com",
536
- token: "dxm_your_api_key"
537
- });
522
+ const app = dxMail();
523
+
524
+ app.auth("dxm_your_api_key");
538
525
 
539
526
  async function main() {
540
527
  const created = await app.createMail("demo");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dx-mail",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "DX Mail client for temp mail API and realtime inbox watcher",
5
5
  "main": "index.js",
6
6
  "keywords": [