dx-mail 1.0.1 → 1.0.2

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 (4) hide show
  1. package/README.md +273 -0
  2. package/a.js +1 -1
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,273 @@
1
+ # 📬 DX Mail
2
+
3
+ ![npm](https://img.shields.io/npm/v/dx-mail)
4
+ ![downloads](https://img.shields.io/npm/dm/dx-mail)
5
+ ![license](https://img.shields.io/npm/l/dx-mail)
6
+
7
+ Fast temporary email client with realtime inbox updates powered by WebSocket.
8
+
9
+ Create temporary emails, receive messages instantly, and integrate easily with Telegram bots, WhatsApp bots, web dashboards, or Node.js applications.
10
+
11
+ ✨ Features
12
+
13
+ - 🚀 Create random or custom temporary email addresses
14
+ - ⚡ Realtime inbox updates using WebSocket
15
+ - 📥 Fetch message history
16
+ - 🤖 Perfect for Telegram and WhatsApp bots
17
+ - 🌐 Works for web inbox applications
18
+ - 🔑 API Key authentication
19
+ - 📦 Lightweight and easy to use
20
+
21
+ ---
22
+
23
+ Installation
24
+
25
+ npm install dx-mail
26
+
27
+ ---
28
+
29
+ Quick Start
30
+
31
+ const dxMail = require("dx-mail");
32
+
33
+ const app = dxMail({
34
+ baseUrl: "https://your-server.com",
35
+ token: "dxm_your_api_key"
36
+ });
37
+
38
+ async function main() {
39
+ const res = await app.createMail();
40
+
41
+ console.log("Email:");
42
+ console.log(res.inbox.address);
43
+ }
44
+
45
+ main();
46
+
47
+ ---
48
+
49
+ Authentication
50
+
51
+ Option 1
52
+
53
+ const app = dxMail({
54
+ baseUrl: "https://your-server.com",
55
+ token: "dxm_your_api_key"
56
+ });
57
+
58
+ Option 2
59
+
60
+ const app = dxMail();
61
+
62
+ app.setBaseUrl("https://your-server.com");
63
+ app.auth("dxm_your_api_key");
64
+
65
+ ---
66
+
67
+ API
68
+
69
+ createMail()
70
+
71
+ Create a random email address.
72
+
73
+ const res = await app.createMail();
74
+
75
+ console.log(res.inbox.address);
76
+
77
+ Example:
78
+
79
+ m7fa8d3c21a@danxy.web.id
80
+
81
+ ---
82
+
83
+ createMail(name)
84
+
85
+ Create a custom email address.
86
+
87
+ const res = await app.createMail("test");
88
+
89
+ console.log(res.inbox.address);
90
+
91
+ Output:
92
+
93
+ test@danxy.web.id
94
+
95
+ ---
96
+
97
+ createMail(callback)
98
+
99
+ Callback style.
100
+
101
+ app.createMail((res) => {
102
+ console.log(res.inbox.address);
103
+ });
104
+
105
+ ---
106
+
107
+ createMail(name, callback)
108
+
109
+ app.createMail("test", (res) => {
110
+ console.log(res.inbox.address);
111
+ });
112
+
113
+ ---
114
+
115
+ listMail()
116
+
117
+ Get all inboxes owned by your API key.
118
+
119
+ const res = await app.listMail();
120
+
121
+ console.log(res.inboxes);
122
+
123
+ Example:
124
+
125
+ [
126
+ {
127
+ id: "...",
128
+ name: "test",
129
+ address: "test@danxy.web.id"
130
+ }
131
+ ]
132
+
133
+ ---
134
+
135
+ getMail(name)
136
+
137
+ Get message history.
138
+
139
+ const res = await app.getMail("test");
140
+
141
+ console.log(res.messages);
142
+
143
+ ---
144
+
145
+ watchMail(name)
146
+
147
+ Receive emails instantly.
148
+
149
+ app.watchMail("test", (event) => {
150
+ console.log(event.message.subject);
151
+ console.log(event.message.text);
152
+ });
153
+
154
+ Example:
155
+
156
+ 📩 New Email
157
+ Subject: Hello
158
+ Text: Welcome to DX Mail
159
+
160
+ ---
161
+
162
+ HTML Emails
163
+
164
+ DX Mail supports HTML emails.
165
+
166
+ app.watchMail("test", (event) => {
167
+ console.log(event.message.html);
168
+ });
169
+
170
+ Useful for:
171
+
172
+ - OpenAI verification emails
173
+ - GitHub notifications
174
+ - Discord verification emails
175
+ - Banking emails
176
+ - Newsletter emails
177
+ - OTP services
178
+
179
+ ---
180
+
181
+ waitMail(name)
182
+
183
+ Wait until a new email arrives.
184
+
185
+ const event = await app.waitMail("test");
186
+
187
+ console.log(event.message.subject);
188
+
189
+ With timeout:
190
+
191
+ const event = await app.waitMail("test", {
192
+ timeoutMs: 30000
193
+ });
194
+
195
+ ---
196
+
197
+ watchAll()
198
+
199
+ Watch all inboxes owned by the API key.
200
+
201
+ app.watchAll((event) => {
202
+ console.log(event.inbox.address);
203
+ console.log(event.message.subject);
204
+ });
205
+
206
+ ---
207
+
208
+ close()
209
+
210
+ Close WebSocket connection.
211
+
212
+ app.close();
213
+
214
+ ---
215
+
216
+ Message Object
217
+
218
+ {
219
+ id: "...",
220
+ to: "test@danxy.web.id",
221
+ from: "noreply@example.com",
222
+ subject: "Hello",
223
+ text: "Welcome!",
224
+ html: "<h1>Welcome!</h1>",
225
+ attachments: [],
226
+ receivedAt: "2026-06-27T14:00:00.000Z"
227
+ }
228
+
229
+ ---
230
+
231
+ Telegram Example
232
+
233
+ const dxMail = require("dx-mail");
234
+
235
+ const app = dxMail({
236
+ baseUrl: "https://your-server.com",
237
+ token: "dxm_your_api_key"
238
+ });
239
+
240
+ const inbox = await app.createMail();
241
+
242
+ app.watchMail(inbox.inbox.name, (event) => {
243
+ bot.telegram.sendMessage(
244
+ chatId,
245
+ `📩 ${event.message.subject}\n\n${event.message.text}`
246
+ );
247
+ });
248
+
249
+ ---
250
+
251
+ Web Dashboard Example
252
+
253
+ app.watchMail("test", (event) => {
254
+ renderMessage(event.message);
255
+ });
256
+
257
+ ---
258
+
259
+ Requirements
260
+
261
+ - Node.js 18+
262
+ - DX Mail Server
263
+ - Valid API Key
264
+
265
+ ---
266
+
267
+ License
268
+
269
+ MIT
270
+
271
+ ---
272
+
273
+ Made with ❤️ for developers who need fast temporary emails and realtime inbox updates.
package/a.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const mail = require("./index.js");
2
2
  const app = mail();
3
3
 
4
- app.setBaseUrl("https://mailsrv-1a31daad9cb8.herokuapp.com");
4
+ //app.setBaseUrl("https://mailsrv-1a31daad9cb8.herokuapp.com");
5
5
  app.auth("dxm_46a9ac05fd8230b856f6d4fb1e1f4c5af63f6b045cda4a48");
6
6
 
7
7
  app.createMail("anj", (res) => {
package/index.js CHANGED
@@ -43,7 +43,7 @@ class DxMailClient extends EventEmitter {
43
43
  this.baseUrl = cleanBaseUrl(
44
44
  options.baseUrl ||
45
45
  process.env.DX_MAIL_BASE_URL ||
46
- "http://localhost:3000"
46
+ "https://mailsrv-1a31daad9cb8.herokuapp.com"
47
47
  );
48
48
 
49
49
  this.token = options.token || process.env.DX_MAIL_TOKEN || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dx-mail",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "DX Mail client for temp mail API and realtime inbox watcher",
5
5
  "main": "index.js",
6
6
  "keywords": [