mailpit-api 1.0.1 → 1.0.2-beta.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.
- package/dist/MailpitClient.d.ts +251 -0
- package/dist/MailpitClient.js +121 -0
- package/dist/MailpitClient.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +3 -2
- package/src/MailpitClient.ts +467 -0
- package/src/index.ts +2 -466
- package/tsconfig.json +8 -5
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
export interface MailpitInfo {
|
|
2
|
+
Database: string;
|
|
3
|
+
DatabaseSize: number;
|
|
4
|
+
LatestVersion: string;
|
|
5
|
+
Messages: number;
|
|
6
|
+
RuntimeStats: {
|
|
7
|
+
Memory: number;
|
|
8
|
+
MessagesDeleted: number;
|
|
9
|
+
SMTPAccepted: number;
|
|
10
|
+
SMTPAcceptedSize: number;
|
|
11
|
+
SMTPIgnored: number;
|
|
12
|
+
SMTPRejected: number;
|
|
13
|
+
Uptime: number;
|
|
14
|
+
};
|
|
15
|
+
Tags: {
|
|
16
|
+
[key: string]: number;
|
|
17
|
+
};
|
|
18
|
+
Unread: number;
|
|
19
|
+
Version: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MailpitConfiguration {
|
|
22
|
+
DuplicatesIgnored: boolean;
|
|
23
|
+
Label: string;
|
|
24
|
+
SpamAssassin: boolean;
|
|
25
|
+
MessageRelay: {
|
|
26
|
+
AllowedRecipients: string;
|
|
27
|
+
Enabled: boolean;
|
|
28
|
+
ReturnPath: string;
|
|
29
|
+
SMTPServer: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface MailpitMessageSummary {
|
|
33
|
+
Attachments: [
|
|
34
|
+
{
|
|
35
|
+
ContentID: string;
|
|
36
|
+
ContentType: string;
|
|
37
|
+
FileName: string;
|
|
38
|
+
PartID: string;
|
|
39
|
+
Size: number;
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
Bcc: [
|
|
43
|
+
{
|
|
44
|
+
Address: string;
|
|
45
|
+
Name: string;
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
Cc: [
|
|
49
|
+
{
|
|
50
|
+
Address: string;
|
|
51
|
+
Name: string;
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
Date: string;
|
|
55
|
+
From: {
|
|
56
|
+
Address: string;
|
|
57
|
+
Name: string;
|
|
58
|
+
};
|
|
59
|
+
HTML: string;
|
|
60
|
+
ID: string;
|
|
61
|
+
Inline: [
|
|
62
|
+
{
|
|
63
|
+
ContentID: string;
|
|
64
|
+
ContentType: string;
|
|
65
|
+
FileName: string;
|
|
66
|
+
PartID: string;
|
|
67
|
+
Size: number;
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
MessageID: string;
|
|
71
|
+
ReplyTo: [
|
|
72
|
+
{
|
|
73
|
+
Address: string;
|
|
74
|
+
Name: string;
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
ReturnPath: string;
|
|
78
|
+
Size: number;
|
|
79
|
+
Subject: string;
|
|
80
|
+
Tags: [string];
|
|
81
|
+
Text: string;
|
|
82
|
+
To: [
|
|
83
|
+
{
|
|
84
|
+
Address: string;
|
|
85
|
+
Name: string;
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
export interface MailpitMessagesSummary {
|
|
90
|
+
messages: [MailpitMessageSummary];
|
|
91
|
+
}
|
|
92
|
+
export interface MailpitMessageHeaders {
|
|
93
|
+
[key: string]: string;
|
|
94
|
+
}
|
|
95
|
+
export interface MailpitSendRequest {
|
|
96
|
+
Attachments: [
|
|
97
|
+
{
|
|
98
|
+
Content: string;
|
|
99
|
+
Filename: string;
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
Bcc: [string];
|
|
103
|
+
Cc: [
|
|
104
|
+
{
|
|
105
|
+
Email: string;
|
|
106
|
+
Name: string;
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
From: {
|
|
110
|
+
Email: string;
|
|
111
|
+
Name: string;
|
|
112
|
+
};
|
|
113
|
+
HTML: string;
|
|
114
|
+
Headers: {
|
|
115
|
+
[key: string]: string;
|
|
116
|
+
};
|
|
117
|
+
ReplyTo: [
|
|
118
|
+
{
|
|
119
|
+
Email: string;
|
|
120
|
+
Name: string;
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
Subject: string;
|
|
124
|
+
Tags: [string];
|
|
125
|
+
Text: string;
|
|
126
|
+
To: [
|
|
127
|
+
{
|
|
128
|
+
Email: string;
|
|
129
|
+
Name: string;
|
|
130
|
+
}
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
export interface MailpitSendMessageConfirmation {
|
|
134
|
+
ID: string;
|
|
135
|
+
}
|
|
136
|
+
export interface MailpitHTMLCheckResponse {
|
|
137
|
+
Platforms: {
|
|
138
|
+
[key: string]: [string];
|
|
139
|
+
};
|
|
140
|
+
Total: {
|
|
141
|
+
Nodes: number;
|
|
142
|
+
Partial: number;
|
|
143
|
+
Supported: number;
|
|
144
|
+
Tests: number;
|
|
145
|
+
Unsupported: number;
|
|
146
|
+
};
|
|
147
|
+
Warnings: [
|
|
148
|
+
{
|
|
149
|
+
Category: "css" | "html";
|
|
150
|
+
Description: string;
|
|
151
|
+
Keywords: string;
|
|
152
|
+
NotesByNumber: {
|
|
153
|
+
[key: string]: string;
|
|
154
|
+
};
|
|
155
|
+
Results: [
|
|
156
|
+
{
|
|
157
|
+
Family: string;
|
|
158
|
+
Name: string;
|
|
159
|
+
NoteNumber: string;
|
|
160
|
+
Platform: string;
|
|
161
|
+
Support: "yes" | "no" | "partial";
|
|
162
|
+
Version: string;
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
Score: {
|
|
166
|
+
Found: number;
|
|
167
|
+
Partial: number;
|
|
168
|
+
Supported: number;
|
|
169
|
+
Unsupported: number;
|
|
170
|
+
};
|
|
171
|
+
Slug: string;
|
|
172
|
+
Tags: [string];
|
|
173
|
+
Title: string;
|
|
174
|
+
URL: string;
|
|
175
|
+
}
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
export interface MailpitLinkCheckResponse {
|
|
179
|
+
Errors: number;
|
|
180
|
+
Links: [
|
|
181
|
+
{
|
|
182
|
+
Status: string;
|
|
183
|
+
StatusCode: number;
|
|
184
|
+
URL: string;
|
|
185
|
+
}
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
export interface MailpitSpamAssassinResponse {
|
|
189
|
+
Errors: number;
|
|
190
|
+
IsSpam: boolean;
|
|
191
|
+
Rules: [
|
|
192
|
+
{
|
|
193
|
+
Description: string;
|
|
194
|
+
Name: string;
|
|
195
|
+
Score: number;
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
Score: number;
|
|
199
|
+
}
|
|
200
|
+
export interface MailpitReadStatusRequest {
|
|
201
|
+
IDs: [string];
|
|
202
|
+
Read: boolean;
|
|
203
|
+
}
|
|
204
|
+
export interface MailpitDeleteRequest {
|
|
205
|
+
IDs: [string];
|
|
206
|
+
}
|
|
207
|
+
export interface MailpitSearch {
|
|
208
|
+
query: string;
|
|
209
|
+
start: number;
|
|
210
|
+
limit: number;
|
|
211
|
+
tz: string;
|
|
212
|
+
}
|
|
213
|
+
export interface MailpitSearchDelete {
|
|
214
|
+
query: string;
|
|
215
|
+
tz: string;
|
|
216
|
+
}
|
|
217
|
+
export interface MailpitSetTagsRequest {
|
|
218
|
+
IDs: [string];
|
|
219
|
+
Tags: [string];
|
|
220
|
+
}
|
|
221
|
+
export declare class MailpitClient {
|
|
222
|
+
private axiosInstance;
|
|
223
|
+
constructor(baseURL: string);
|
|
224
|
+
private handleRequest;
|
|
225
|
+
getInfo(): Promise<MailpitInfo>;
|
|
226
|
+
getConfiguration(): Promise<MailpitConfiguration>;
|
|
227
|
+
getMessageSummary(id: string): Promise<MailpitMessageSummary>;
|
|
228
|
+
getMessageHeaders(id: string): Promise<MailpitMessageHeaders>;
|
|
229
|
+
getMessageAttachment(id: string, partID: string): Promise<string>;
|
|
230
|
+
getMessageSource(id: string): Promise<string>;
|
|
231
|
+
getAttachmentThumbnail(id: string, partID: string): Promise<string>;
|
|
232
|
+
releaseMessage(id: string, releaseRequest: {
|
|
233
|
+
To: string[];
|
|
234
|
+
}): Promise<string>;
|
|
235
|
+
sendMessage(sendReqest: MailpitSendRequest): Promise<MailpitSendMessageConfirmation>;
|
|
236
|
+
htmlCheck(id: string): Promise<MailpitHTMLCheckResponse>;
|
|
237
|
+
linkCheck(id: string): Promise<MailpitLinkCheckResponse>;
|
|
238
|
+
spamAssassinCheck(id: string): Promise<MailpitSpamAssassinResponse>;
|
|
239
|
+
listMessages(): Promise<MailpitMessagesSummary>;
|
|
240
|
+
setReadStatus(readStatus: MailpitReadStatusRequest): Promise<string>;
|
|
241
|
+
deleteMessages(deleteRequest: MailpitDeleteRequest): Promise<string>;
|
|
242
|
+
searchMessages(search: MailpitSearch): Promise<MailpitMessagesSummary>;
|
|
243
|
+
deleteMessagesBySearch(search: MailpitSearchDelete): Promise<string>;
|
|
244
|
+
getTags(): Promise<[string]>;
|
|
245
|
+
setTags(request: MailpitSetTagsRequest): Promise<string>;
|
|
246
|
+
renameTag(tag: string, newTagName: string): Promise<string>;
|
|
247
|
+
deleteTag(tag: string): Promise<string>;
|
|
248
|
+
renderMessageHTML(id: string): Promise<string>;
|
|
249
|
+
renderMessageText(id: string): Promise<string>;
|
|
250
|
+
}
|
|
251
|
+
export default MailpitClient;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export class MailpitClient {
|
|
3
|
+
axiosInstance;
|
|
4
|
+
constructor(baseURL) {
|
|
5
|
+
this.axiosInstance = axios.create({
|
|
6
|
+
baseURL: baseURL,
|
|
7
|
+
validateStatus: function (status) {
|
|
8
|
+
return status === 200;
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async handleRequest(request) {
|
|
13
|
+
try {
|
|
14
|
+
const response = await request();
|
|
15
|
+
return response.data;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (axios.isAxiosError(error)) {
|
|
19
|
+
if (error.response) {
|
|
20
|
+
// Server responded with a status other than 2xx
|
|
21
|
+
throw new Error(`Mailpit API Error: ${error.response.status} ${error.response.statusText}: ${JSON.stringify(error.response.data)}`);
|
|
22
|
+
}
|
|
23
|
+
else if (error.request) {
|
|
24
|
+
// Request was made but no response was received
|
|
25
|
+
throw new Error("Mailpit API Error: No response received from server.");
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// Something happened in setting up the request
|
|
29
|
+
throw new Error(`Mailpit API Error: ${error.message}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new Error("Unexpected Error: " + error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Message
|
|
38
|
+
async getInfo() {
|
|
39
|
+
return this.handleRequest(() => this.axiosInstance.get("/api/v1/info"));
|
|
40
|
+
}
|
|
41
|
+
async getConfiguration() {
|
|
42
|
+
return this.handleRequest(() => this.axiosInstance.get("/api/v1/webui"));
|
|
43
|
+
}
|
|
44
|
+
async getMessageSummary(id) {
|
|
45
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}`));
|
|
46
|
+
}
|
|
47
|
+
async getMessageHeaders(id) {
|
|
48
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}/headers`));
|
|
49
|
+
}
|
|
50
|
+
async getMessageAttachment(id, partID) {
|
|
51
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}/part/${partID}`));
|
|
52
|
+
}
|
|
53
|
+
async getMessageSource(id) {
|
|
54
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}/raw`));
|
|
55
|
+
}
|
|
56
|
+
async getAttachmentThumbnail(id, partID) {
|
|
57
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}/part/${partID}/thumb`));
|
|
58
|
+
}
|
|
59
|
+
async releaseMessage(id, releaseRequest) {
|
|
60
|
+
return this.handleRequest(() => this.axiosInstance.post(`/api/v1/message/${id}/release`, releaseRequest));
|
|
61
|
+
}
|
|
62
|
+
async sendMessage(sendReqest) {
|
|
63
|
+
return this.handleRequest(() => this.axiosInstance.post(`/api/v1/send`, sendReqest));
|
|
64
|
+
}
|
|
65
|
+
// Other
|
|
66
|
+
async htmlCheck(id) {
|
|
67
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}/html-check`));
|
|
68
|
+
}
|
|
69
|
+
async linkCheck(id) {
|
|
70
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}/link-check`));
|
|
71
|
+
}
|
|
72
|
+
async spamAssassinCheck(id) {
|
|
73
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/message/${id}/sa-check`));
|
|
74
|
+
}
|
|
75
|
+
// Messages
|
|
76
|
+
async listMessages() {
|
|
77
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/messages`));
|
|
78
|
+
}
|
|
79
|
+
async setReadStatus(readStatus) {
|
|
80
|
+
return this.handleRequest(() => this.axiosInstance.put(`/api/v1/messages`, readStatus));
|
|
81
|
+
}
|
|
82
|
+
async deleteMessages(deleteRequest) {
|
|
83
|
+
return this.handleRequest(() => this.axiosInstance.delete(`/api/v1/messages`, {
|
|
84
|
+
data: deleteRequest,
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
// See https://mailpit.axllent.org/docs/usage/search-filters/
|
|
88
|
+
async searchMessages(search) {
|
|
89
|
+
return this.handleRequest(() => this.axiosInstance.put(`/api/v1/search`, search));
|
|
90
|
+
}
|
|
91
|
+
// See https://mailpit.axllent.org/docs/usage/search-filters/
|
|
92
|
+
async deleteMessagesBySearch(search) {
|
|
93
|
+
return this.handleRequest(() => this.axiosInstance.delete(`/api/v1/search`, { data: search }));
|
|
94
|
+
}
|
|
95
|
+
// Tags
|
|
96
|
+
async getTags() {
|
|
97
|
+
return this.handleRequest(() => this.axiosInstance.get(`/api/v1/tags`));
|
|
98
|
+
}
|
|
99
|
+
async setTags(request) {
|
|
100
|
+
return this.handleRequest(() => this.axiosInstance.put(`/api/v1/tags`, request));
|
|
101
|
+
}
|
|
102
|
+
async renameTag(tag, newTagName) {
|
|
103
|
+
const encodedTag = encodeURI(tag);
|
|
104
|
+
return this.handleRequest(() => this.axiosInstance.put(`/api/v1/tags/${encodedTag}`, {
|
|
105
|
+
Name: newTagName,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
async deleteTag(tag) {
|
|
109
|
+
const encodedTag = encodeURI(tag);
|
|
110
|
+
return this.handleRequest(() => this.axiosInstance.delete(`/api/v1/tags/${encodedTag}`));
|
|
111
|
+
}
|
|
112
|
+
// Testing
|
|
113
|
+
async renderMessageHTML(id) {
|
|
114
|
+
return this.handleRequest(() => this.axiosInstance.get(`/view/${id}.html`));
|
|
115
|
+
}
|
|
116
|
+
async renderMessageText(id) {
|
|
117
|
+
return this.handleRequest(() => this.axiosInstance.get(`/view/${id}.txt`));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export default MailpitClient;
|
|
121
|
+
//# sourceMappingURL=MailpitClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailpitClient.js","sourceRoot":"","sources":["../src/MailpitClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AA6O7C,MAAM,OAAO,aAAa;IAChB,aAAa,CAAgB;IAErC,YAAY,OAAe;QACzB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;YAChC,OAAO,EAAE,OAAO;YAChB,cAAc,EAAE,UAAU,MAAM;gBAC9B,OAAO,MAAM,KAAK,GAAG,CAAC;YACxB,CAAC;SACF,CAAC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iBAAiB,CAAC,EAAU;QACvC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAC7B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,SAAS,EAAE,OAAO,CAAC,CACnD,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,EAAU;QACvC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAC7B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,SAAS,EAAE,MAAM,CAAC,CAClD,CAAC;IACJ,CAAC;CACF;AAED,eAAe,aAAa,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailpit-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-beta.2",
|
|
4
4
|
"description": "A NodeJS client library, written in TypeScript, to interact with the Mailpit API.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/mpspahr/mailpit-api.git"
|
|
8
8
|
},
|
|
9
|
-
"main": "
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
10
11
|
"scripts": {
|
|
11
12
|
"test": "echo \"TODO: Add tests\" && exit 0",
|
|
12
13
|
"build": "tsc"
|
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import axios, { AxiosInstance } from "axios";
|
|
2
|
+
|
|
3
|
+
export interface MailpitInfo {
|
|
4
|
+
Database: string;
|
|
5
|
+
DatabaseSize: number;
|
|
6
|
+
LatestVersion: string;
|
|
7
|
+
Messages: number;
|
|
8
|
+
RuntimeStats: {
|
|
9
|
+
Memory: number;
|
|
10
|
+
MessagesDeleted: number;
|
|
11
|
+
SMTPAccepted: number;
|
|
12
|
+
SMTPAcceptedSize: number;
|
|
13
|
+
SMTPIgnored: number;
|
|
14
|
+
SMTPRejected: number;
|
|
15
|
+
Uptime: number;
|
|
16
|
+
};
|
|
17
|
+
Tags: {
|
|
18
|
+
[key: string]: number;
|
|
19
|
+
};
|
|
20
|
+
Unread: number;
|
|
21
|
+
Version: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface MailpitConfiguration {
|
|
25
|
+
DuplicatesIgnored: boolean;
|
|
26
|
+
Label: string;
|
|
27
|
+
SpamAssassin: boolean;
|
|
28
|
+
MessageRelay: {
|
|
29
|
+
AllowedRecipients: string;
|
|
30
|
+
Enabled: boolean;
|
|
31
|
+
ReturnPath: string;
|
|
32
|
+
SMTPServer: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface MailpitMessageSummary {
|
|
37
|
+
Attachments: [
|
|
38
|
+
{
|
|
39
|
+
ContentID: string;
|
|
40
|
+
ContentType: string;
|
|
41
|
+
FileName: string;
|
|
42
|
+
PartID: string;
|
|
43
|
+
Size: number;
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
Bcc: [
|
|
47
|
+
{
|
|
48
|
+
Address: string;
|
|
49
|
+
Name: string;
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
Cc: [
|
|
53
|
+
{
|
|
54
|
+
Address: string;
|
|
55
|
+
Name: string;
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
Date: string;
|
|
59
|
+
From: {
|
|
60
|
+
Address: string;
|
|
61
|
+
Name: string;
|
|
62
|
+
};
|
|
63
|
+
HTML: string;
|
|
64
|
+
ID: string;
|
|
65
|
+
Inline: [
|
|
66
|
+
{
|
|
67
|
+
ContentID: string;
|
|
68
|
+
ContentType: string;
|
|
69
|
+
FileName: string;
|
|
70
|
+
PartID: string;
|
|
71
|
+
Size: number;
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
MessageID: string;
|
|
75
|
+
ReplyTo: [
|
|
76
|
+
{
|
|
77
|
+
Address: string;
|
|
78
|
+
Name: string;
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
ReturnPath: string;
|
|
82
|
+
Size: number;
|
|
83
|
+
Subject: string;
|
|
84
|
+
Tags: [string];
|
|
85
|
+
Text: string;
|
|
86
|
+
To: [
|
|
87
|
+
{
|
|
88
|
+
Address: string;
|
|
89
|
+
Name: string;
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface MailpitMessagesSummary {
|
|
95
|
+
messages: [MailpitMessageSummary];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface MailpitMessageHeaders {
|
|
99
|
+
[key: string]: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface MailpitSendRequest {
|
|
103
|
+
Attachments: [
|
|
104
|
+
{
|
|
105
|
+
Content: string;
|
|
106
|
+
Filename: string;
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
Bcc: [string];
|
|
110
|
+
Cc: [
|
|
111
|
+
{
|
|
112
|
+
Email: string;
|
|
113
|
+
Name: string;
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
From: {
|
|
117
|
+
Email: string;
|
|
118
|
+
Name: string;
|
|
119
|
+
};
|
|
120
|
+
HTML: string;
|
|
121
|
+
Headers: {
|
|
122
|
+
[key: string]: string;
|
|
123
|
+
};
|
|
124
|
+
ReplyTo: [
|
|
125
|
+
{
|
|
126
|
+
Email: string;
|
|
127
|
+
Name: string;
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
Subject: string;
|
|
131
|
+
Tags: [string];
|
|
132
|
+
Text: string;
|
|
133
|
+
To: [
|
|
134
|
+
{
|
|
135
|
+
Email: string;
|
|
136
|
+
Name: string;
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface MailpitSendMessageConfirmation {
|
|
142
|
+
ID: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface MailpitHTMLCheckResponse {
|
|
146
|
+
Platforms: {
|
|
147
|
+
[key: string]: [string];
|
|
148
|
+
};
|
|
149
|
+
Total: {
|
|
150
|
+
Nodes: number;
|
|
151
|
+
Partial: number;
|
|
152
|
+
Supported: number;
|
|
153
|
+
Tests: number;
|
|
154
|
+
Unsupported: number;
|
|
155
|
+
};
|
|
156
|
+
Warnings: [
|
|
157
|
+
{
|
|
158
|
+
Category: "css" | "html";
|
|
159
|
+
Description: string;
|
|
160
|
+
Keywords: string;
|
|
161
|
+
NotesByNumber: {
|
|
162
|
+
[key: string]: string;
|
|
163
|
+
};
|
|
164
|
+
Results: [
|
|
165
|
+
{
|
|
166
|
+
Family: string;
|
|
167
|
+
Name: string;
|
|
168
|
+
NoteNumber: string;
|
|
169
|
+
Platform: string;
|
|
170
|
+
Support: "yes" | "no" | "partial";
|
|
171
|
+
Version: string;
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
Score: {
|
|
175
|
+
Found: number;
|
|
176
|
+
Partial: number;
|
|
177
|
+
Supported: number;
|
|
178
|
+
Unsupported: number;
|
|
179
|
+
};
|
|
180
|
+
Slug: string;
|
|
181
|
+
Tags: [string];
|
|
182
|
+
Title: string;
|
|
183
|
+
URL: string;
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface MailpitLinkCheckResponse {
|
|
189
|
+
Errors: number;
|
|
190
|
+
Links: [
|
|
191
|
+
{
|
|
192
|
+
Status: string;
|
|
193
|
+
StatusCode: number;
|
|
194
|
+
URL: string;
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface MailpitSpamAssassinResponse {
|
|
200
|
+
Errors: number;
|
|
201
|
+
IsSpam: boolean;
|
|
202
|
+
Rules: [
|
|
203
|
+
{
|
|
204
|
+
Description: string;
|
|
205
|
+
Name: string;
|
|
206
|
+
Score: number;
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
Score: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface MailpitReadStatusRequest {
|
|
213
|
+
IDs: [string];
|
|
214
|
+
Read: boolean;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface MailpitDeleteRequest {
|
|
218
|
+
IDs: [string];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface MailpitSearch {
|
|
222
|
+
query: string;
|
|
223
|
+
start: number;
|
|
224
|
+
limit: number;
|
|
225
|
+
tz: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface MailpitSearchDelete {
|
|
229
|
+
query: string;
|
|
230
|
+
tz: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface MailpitSetTagsRequest {
|
|
234
|
+
IDs: [string];
|
|
235
|
+
Tags: [string];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export class MailpitClient {
|
|
239
|
+
private axiosInstance: AxiosInstance;
|
|
240
|
+
|
|
241
|
+
constructor(baseURL: string) {
|
|
242
|
+
this.axiosInstance = axios.create({
|
|
243
|
+
baseURL: baseURL,
|
|
244
|
+
validateStatus: function (status) {
|
|
245
|
+
return status === 200;
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
private async handleRequest<T>(
|
|
251
|
+
request: () => Promise<{ data: T }>,
|
|
252
|
+
): Promise<T> {
|
|
253
|
+
try {
|
|
254
|
+
const response = await request();
|
|
255
|
+
return response.data;
|
|
256
|
+
} catch (error) {
|
|
257
|
+
if (axios.isAxiosError(error)) {
|
|
258
|
+
if (error.response) {
|
|
259
|
+
// Server responded with a status other than 2xx
|
|
260
|
+
throw new Error(
|
|
261
|
+
`Mailpit API Error: ${error.response.status} ${error.response.statusText}: ${JSON.stringify(error.response.data)}`,
|
|
262
|
+
);
|
|
263
|
+
} else if (error.request) {
|
|
264
|
+
// Request was made but no response was received
|
|
265
|
+
throw new Error(
|
|
266
|
+
"Mailpit API Error: No response received from server.",
|
|
267
|
+
);
|
|
268
|
+
} else {
|
|
269
|
+
// Something happened in setting up the request
|
|
270
|
+
throw new Error(`Mailpit API Error: ${error.message}`);
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
throw new Error("Unexpected Error: " + error);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Message
|
|
279
|
+
public async getInfo(): Promise<MailpitInfo> {
|
|
280
|
+
return this.handleRequest(() =>
|
|
281
|
+
this.axiosInstance.get<MailpitInfo>("/api/v1/info"),
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
public async getConfiguration(): Promise<MailpitConfiguration> {
|
|
286
|
+
return this.handleRequest(() =>
|
|
287
|
+
this.axiosInstance.get<MailpitConfiguration>("/api/v1/webui"),
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
public async getMessageSummary(id: string): Promise<MailpitMessageSummary> {
|
|
292
|
+
return this.handleRequest(() =>
|
|
293
|
+
this.axiosInstance.get<MailpitMessageSummary>(`/api/v1/message/${id}`),
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
public async getMessageHeaders(id: string): Promise<MailpitMessageHeaders> {
|
|
298
|
+
return this.handleRequest(() =>
|
|
299
|
+
this.axiosInstance.get<MailpitMessageHeaders>(
|
|
300
|
+
`/api/v1/message/${id}/headers`,
|
|
301
|
+
),
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
public async getMessageAttachment(
|
|
306
|
+
id: string,
|
|
307
|
+
partID: string,
|
|
308
|
+
): Promise<string> {
|
|
309
|
+
return this.handleRequest(() =>
|
|
310
|
+
this.axiosInstance.get<string>(`/api/v1/message/${id}/part/${partID}`),
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
public async getMessageSource(id: string): Promise<string> {
|
|
315
|
+
return this.handleRequest(() =>
|
|
316
|
+
this.axiosInstance.get<string>(`/api/v1/message/${id}/raw`),
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
public async getAttachmentThumbnail(
|
|
321
|
+
id: string,
|
|
322
|
+
partID: string,
|
|
323
|
+
): Promise<string> {
|
|
324
|
+
return this.handleRequest(() =>
|
|
325
|
+
this.axiosInstance.get<string>(
|
|
326
|
+
`/api/v1/message/${id}/part/${partID}/thumb`,
|
|
327
|
+
),
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
public async releaseMessage(
|
|
332
|
+
id: string,
|
|
333
|
+
releaseRequest: { To: string[] },
|
|
334
|
+
): Promise<string> {
|
|
335
|
+
return this.handleRequest(() =>
|
|
336
|
+
this.axiosInstance.post<string>(
|
|
337
|
+
`/api/v1/message/${id}/release`,
|
|
338
|
+
releaseRequest,
|
|
339
|
+
),
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
public async sendMessage(
|
|
344
|
+
sendReqest: MailpitSendRequest,
|
|
345
|
+
): Promise<MailpitSendMessageConfirmation> {
|
|
346
|
+
return this.handleRequest(() =>
|
|
347
|
+
this.axiosInstance.post<MailpitSendMessageConfirmation>(
|
|
348
|
+
`/api/v1/send`,
|
|
349
|
+
sendReqest,
|
|
350
|
+
),
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Other
|
|
355
|
+
public async htmlCheck(id: string): Promise<MailpitHTMLCheckResponse> {
|
|
356
|
+
return this.handleRequest(() =>
|
|
357
|
+
this.axiosInstance.get<MailpitHTMLCheckResponse>(
|
|
358
|
+
`/api/v1/message/${id}/html-check`,
|
|
359
|
+
),
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
public async linkCheck(id: string): Promise<MailpitLinkCheckResponse> {
|
|
364
|
+
return this.handleRequest(() =>
|
|
365
|
+
this.axiosInstance.get<MailpitLinkCheckResponse>(
|
|
366
|
+
`/api/v1/message/${id}/link-check`,
|
|
367
|
+
),
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
public async spamAssassinCheck(
|
|
372
|
+
id: string,
|
|
373
|
+
): Promise<MailpitSpamAssassinResponse> {
|
|
374
|
+
return this.handleRequest(() =>
|
|
375
|
+
this.axiosInstance.get<MailpitSpamAssassinResponse>(
|
|
376
|
+
`/api/v1/message/${id}/sa-check`,
|
|
377
|
+
),
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// Messages
|
|
382
|
+
public async listMessages(): Promise<MailpitMessagesSummary> {
|
|
383
|
+
return this.handleRequest(() =>
|
|
384
|
+
this.axiosInstance.get<MailpitMessagesSummary>(`/api/v1/messages`),
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
public async setReadStatus(
|
|
389
|
+
readStatus: MailpitReadStatusRequest,
|
|
390
|
+
): Promise<string> {
|
|
391
|
+
return this.handleRequest(() =>
|
|
392
|
+
this.axiosInstance.put<string>(`/api/v1/messages`, readStatus),
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
public async deleteMessages(
|
|
397
|
+
deleteRequest: MailpitDeleteRequest,
|
|
398
|
+
): Promise<string> {
|
|
399
|
+
return this.handleRequest(() =>
|
|
400
|
+
this.axiosInstance.delete<string>(`/api/v1/messages`, {
|
|
401
|
+
data: deleteRequest,
|
|
402
|
+
}),
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// See https://mailpit.axllent.org/docs/usage/search-filters/
|
|
407
|
+
public async searchMessages(
|
|
408
|
+
search: MailpitSearch,
|
|
409
|
+
): Promise<MailpitMessagesSummary> {
|
|
410
|
+
return this.handleRequest(() =>
|
|
411
|
+
this.axiosInstance.put<MailpitMessagesSummary>(`/api/v1/search`, search),
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// See https://mailpit.axllent.org/docs/usage/search-filters/
|
|
416
|
+
public async deleteMessagesBySearch(
|
|
417
|
+
search: MailpitSearchDelete,
|
|
418
|
+
): Promise<string> {
|
|
419
|
+
return this.handleRequest(() =>
|
|
420
|
+
this.axiosInstance.delete<string>(`/api/v1/search`, { data: search }),
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Tags
|
|
425
|
+
public async getTags(): Promise<[string]> {
|
|
426
|
+
return this.handleRequest(() =>
|
|
427
|
+
this.axiosInstance.get<[string]>(`/api/v1/tags`),
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
public async setTags(request: MailpitSetTagsRequest): Promise<string> {
|
|
432
|
+
return this.handleRequest(() =>
|
|
433
|
+
this.axiosInstance.put<string>(`/api/v1/tags`, request),
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
public async renameTag(tag: string, newTagName: string): Promise<string> {
|
|
438
|
+
const encodedTag = encodeURI(tag);
|
|
439
|
+
return this.handleRequest(() =>
|
|
440
|
+
this.axiosInstance.put<string>(`/api/v1/tags/${encodedTag}`, {
|
|
441
|
+
Name: newTagName,
|
|
442
|
+
}),
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
public async deleteTag(tag: string): Promise<string> {
|
|
447
|
+
const encodedTag = encodeURI(tag);
|
|
448
|
+
return this.handleRequest(() =>
|
|
449
|
+
this.axiosInstance.delete<string>(`/api/v1/tags/${encodedTag}`),
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Testing
|
|
454
|
+
public async renderMessageHTML(id: string): Promise<string> {
|
|
455
|
+
return this.handleRequest(() =>
|
|
456
|
+
this.axiosInstance.get<string>(`/view/${id}.html`),
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
public async renderMessageText(id: string): Promise<string> {
|
|
461
|
+
return this.handleRequest(() =>
|
|
462
|
+
this.axiosInstance.get<string>(`/view/${id}.txt`),
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export default MailpitClient;
|
package/src/index.ts
CHANGED
|
@@ -1,467 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import MailpitClient from "./MailpitClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Database: string;
|
|
5
|
-
DatabaseSize: number;
|
|
6
|
-
LatestVersion: string;
|
|
7
|
-
Messages: number;
|
|
8
|
-
RuntimeStats: {
|
|
9
|
-
Memory: number;
|
|
10
|
-
MessagesDeleted: number;
|
|
11
|
-
SMTPAccepted: number;
|
|
12
|
-
SMTPAcceptedSize: number;
|
|
13
|
-
SMTPIgnored: number;
|
|
14
|
-
SMTPRejected: number;
|
|
15
|
-
Uptime: number;
|
|
16
|
-
};
|
|
17
|
-
Tags: {
|
|
18
|
-
[key: string]: number;
|
|
19
|
-
};
|
|
20
|
-
Unread: number;
|
|
21
|
-
Version: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface MailpitConfiguration {
|
|
25
|
-
DuplicatesIgnored: boolean;
|
|
26
|
-
Label: string;
|
|
27
|
-
SpamAssassin: boolean;
|
|
28
|
-
MessageRelay: {
|
|
29
|
-
AllowedRecipients: string;
|
|
30
|
-
Enabled: boolean;
|
|
31
|
-
ReturnPath: string;
|
|
32
|
-
SMTPServer: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface MailpitMessageSummary {
|
|
37
|
-
Attachments: [
|
|
38
|
-
{
|
|
39
|
-
ContentID: string;
|
|
40
|
-
ContentType: string;
|
|
41
|
-
FileName: string;
|
|
42
|
-
PartID: string;
|
|
43
|
-
Size: number;
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
Bcc: [
|
|
47
|
-
{
|
|
48
|
-
Address: string;
|
|
49
|
-
Name: string;
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
Cc: [
|
|
53
|
-
{
|
|
54
|
-
Address: string;
|
|
55
|
-
Name: string;
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
Date: string;
|
|
59
|
-
From: {
|
|
60
|
-
Address: string;
|
|
61
|
-
Name: string;
|
|
62
|
-
};
|
|
63
|
-
HTML: string;
|
|
64
|
-
ID: string;
|
|
65
|
-
Inline: [
|
|
66
|
-
{
|
|
67
|
-
ContentID: string;
|
|
68
|
-
ContentType: string;
|
|
69
|
-
FileName: string;
|
|
70
|
-
PartID: string;
|
|
71
|
-
Size: number;
|
|
72
|
-
},
|
|
73
|
-
];
|
|
74
|
-
MessageID: string;
|
|
75
|
-
ReplyTo: [
|
|
76
|
-
{
|
|
77
|
-
Address: string;
|
|
78
|
-
Name: string;
|
|
79
|
-
},
|
|
80
|
-
];
|
|
81
|
-
ReturnPath: string;
|
|
82
|
-
Size: number;
|
|
83
|
-
Subject: string;
|
|
84
|
-
Tags: [string];
|
|
85
|
-
Text: string;
|
|
86
|
-
To: [
|
|
87
|
-
{
|
|
88
|
-
Address: string;
|
|
89
|
-
Name: string;
|
|
90
|
-
},
|
|
91
|
-
];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
interface MailpitMessagesSummary {
|
|
95
|
-
messages: [MailpitMessageSummary];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface MailpitMessageHeaders {
|
|
99
|
-
[key: string]: string;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface MailpitSendRequest {
|
|
103
|
-
Attachments: [
|
|
104
|
-
{
|
|
105
|
-
Content: string;
|
|
106
|
-
Filename: string;
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
Bcc: [string];
|
|
110
|
-
Cc: [
|
|
111
|
-
{
|
|
112
|
-
Email: string;
|
|
113
|
-
Name: string;
|
|
114
|
-
},
|
|
115
|
-
];
|
|
116
|
-
From: {
|
|
117
|
-
Email: string;
|
|
118
|
-
Name: string;
|
|
119
|
-
};
|
|
120
|
-
HTML: string;
|
|
121
|
-
Headers: {
|
|
122
|
-
[key: string]: string;
|
|
123
|
-
};
|
|
124
|
-
ReplyTo: [
|
|
125
|
-
{
|
|
126
|
-
Email: string;
|
|
127
|
-
Name: string;
|
|
128
|
-
},
|
|
129
|
-
];
|
|
130
|
-
Subject: string;
|
|
131
|
-
Tags: [string];
|
|
132
|
-
Text: string;
|
|
133
|
-
To: [
|
|
134
|
-
{
|
|
135
|
-
Email: string;
|
|
136
|
-
Name: string;
|
|
137
|
-
},
|
|
138
|
-
];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
interface MailpitSendMessageConfirmation {
|
|
142
|
-
ID: string;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
interface MailpitHTMLCheckResponse {
|
|
146
|
-
Platforms: {
|
|
147
|
-
[key: string]: [string];
|
|
148
|
-
};
|
|
149
|
-
Total: {
|
|
150
|
-
Nodes: number;
|
|
151
|
-
Partial: number;
|
|
152
|
-
Supported: number;
|
|
153
|
-
Tests: number;
|
|
154
|
-
Unsupported: number;
|
|
155
|
-
};
|
|
156
|
-
Warnings: [
|
|
157
|
-
{
|
|
158
|
-
Category: "css" | "html";
|
|
159
|
-
Description: string;
|
|
160
|
-
Keywords: string;
|
|
161
|
-
NotesByNumber: {
|
|
162
|
-
[key: string]: string;
|
|
163
|
-
};
|
|
164
|
-
Results: [
|
|
165
|
-
{
|
|
166
|
-
Family: string;
|
|
167
|
-
Name: string;
|
|
168
|
-
NoteNumber: string;
|
|
169
|
-
Platform: string;
|
|
170
|
-
Support: "yes" | "no" | "partial";
|
|
171
|
-
Version: string;
|
|
172
|
-
},
|
|
173
|
-
];
|
|
174
|
-
Score: {
|
|
175
|
-
Found: number;
|
|
176
|
-
Partial: number;
|
|
177
|
-
Supported: number;
|
|
178
|
-
Unsupported: number;
|
|
179
|
-
};
|
|
180
|
-
Slug: string;
|
|
181
|
-
Tags: [string];
|
|
182
|
-
Title: string;
|
|
183
|
-
URL: string;
|
|
184
|
-
},
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
interface MailpitLinkCheckResponse {
|
|
189
|
-
Errors: number;
|
|
190
|
-
Links: [
|
|
191
|
-
{
|
|
192
|
-
Status: string;
|
|
193
|
-
StatusCode: number;
|
|
194
|
-
URL: string;
|
|
195
|
-
},
|
|
196
|
-
];
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
interface MailpitSpamAssassinResponse {
|
|
200
|
-
Errors: number;
|
|
201
|
-
IsSpam: boolean;
|
|
202
|
-
Rules: [
|
|
203
|
-
{
|
|
204
|
-
Description: string;
|
|
205
|
-
Name: string;
|
|
206
|
-
Score: number;
|
|
207
|
-
},
|
|
208
|
-
];
|
|
209
|
-
Score: number;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
interface MailpitReadStatusRequest {
|
|
213
|
-
IDs: [string];
|
|
214
|
-
Read: boolean;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
interface MailpitDeleteRequest {
|
|
218
|
-
IDs: [string];
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
interface MailpitSearch {
|
|
222
|
-
query: string;
|
|
223
|
-
start: number;
|
|
224
|
-
limit: number;
|
|
225
|
-
tz: string;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
interface MailpitSearchDelete {
|
|
229
|
-
query: string;
|
|
230
|
-
tz: string;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
interface MailpitSetTagsRequest {
|
|
234
|
-
IDs: [string];
|
|
235
|
-
Tags: [string];
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
class MailpitClient {
|
|
239
|
-
private axiosInstance: AxiosInstance;
|
|
240
|
-
|
|
241
|
-
constructor(baseURL: string) {
|
|
242
|
-
this.axiosInstance = axios.create({
|
|
243
|
-
baseURL: baseURL,
|
|
244
|
-
validateStatus: function (status) {
|
|
245
|
-
return status === 200;
|
|
246
|
-
},
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
private async handleRequest<T>(
|
|
251
|
-
request: () => Promise<{ data: T }>,
|
|
252
|
-
): Promise<T> {
|
|
253
|
-
try {
|
|
254
|
-
const response = await request();
|
|
255
|
-
return response.data;
|
|
256
|
-
} catch (error) {
|
|
257
|
-
if (axios.isAxiosError(error)) {
|
|
258
|
-
if (error.response) {
|
|
259
|
-
// Server responded with a status other than 2xx
|
|
260
|
-
throw new Error(
|
|
261
|
-
`Mailpit API Error: ${error.response.status} ${error.response.statusText}: ${JSON.stringify(error.response.data)}`,
|
|
262
|
-
);
|
|
263
|
-
} else if (error.request) {
|
|
264
|
-
// Request was made but no response was received
|
|
265
|
-
throw new Error(
|
|
266
|
-
"Mailpit API Error: No response received from server.",
|
|
267
|
-
);
|
|
268
|
-
} else {
|
|
269
|
-
// Something happened in setting up the request
|
|
270
|
-
throw new Error(`Mailpit API Error: ${error.message}`);
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
throw new Error("Unexpected Error: " + error);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// Message
|
|
279
|
-
public async getInfo(): Promise<MailpitInfo> {
|
|
280
|
-
return this.handleRequest(() =>
|
|
281
|
-
this.axiosInstance.get<MailpitInfo>("/api/v1/info"),
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
public async getConfiguration(): Promise<MailpitConfiguration> {
|
|
286
|
-
return this.handleRequest(() =>
|
|
287
|
-
this.axiosInstance.get<MailpitConfiguration>("/api/v1/webui"),
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
public async getMessageSummary(id: string): Promise<MailpitMessageSummary> {
|
|
292
|
-
return this.handleRequest(() =>
|
|
293
|
-
this.axiosInstance.get<MailpitMessageSummary>(`/api/v1/message/${id}`),
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
public async getMessageHeaders(id: string): Promise<MailpitMessageHeaders> {
|
|
298
|
-
return this.handleRequest(() =>
|
|
299
|
-
this.axiosInstance.get<MailpitMessageHeaders>(
|
|
300
|
-
`/api/v1/message/${id}/headers`,
|
|
301
|
-
),
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
public async getMessageAttachment(
|
|
306
|
-
id: string,
|
|
307
|
-
partID: string,
|
|
308
|
-
): Promise<string> {
|
|
309
|
-
return this.handleRequest(() =>
|
|
310
|
-
this.axiosInstance.get<string>(`/api/v1/message/${id}/part/${partID}`),
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
public async getMessageSource(id: string): Promise<string> {
|
|
315
|
-
return this.handleRequest(() =>
|
|
316
|
-
this.axiosInstance.get<string>(`/api/v1/message/${id}/raw`),
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
public async getAttachmentThumbnail(
|
|
321
|
-
id: string,
|
|
322
|
-
partID: string,
|
|
323
|
-
): Promise<string> {
|
|
324
|
-
return this.handleRequest(() =>
|
|
325
|
-
this.axiosInstance.get<string>(
|
|
326
|
-
`/api/v1/message/${id}/part/${partID}/thumb`,
|
|
327
|
-
),
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
public async releaseMessage(
|
|
332
|
-
id: string,
|
|
333
|
-
releaseRequest: { To: string[] },
|
|
334
|
-
): Promise<string> {
|
|
335
|
-
return this.handleRequest(() =>
|
|
336
|
-
this.axiosInstance.post<string>(
|
|
337
|
-
`/api/v1/message/${id}/release`,
|
|
338
|
-
releaseRequest,
|
|
339
|
-
),
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
public async sendMessage(
|
|
344
|
-
sendReqest: MailpitSendRequest,
|
|
345
|
-
): Promise<MailpitSendMessageConfirmation> {
|
|
346
|
-
return this.handleRequest(() =>
|
|
347
|
-
this.axiosInstance.post<MailpitSendMessageConfirmation>(
|
|
348
|
-
`/api/v1/send`,
|
|
349
|
-
sendReqest,
|
|
350
|
-
),
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// Other
|
|
355
|
-
public async htmlCheck(id: string): Promise<MailpitHTMLCheckResponse> {
|
|
356
|
-
return this.handleRequest(() =>
|
|
357
|
-
this.axiosInstance.get<MailpitHTMLCheckResponse>(
|
|
358
|
-
`/api/v1/message/${id}/html-check`,
|
|
359
|
-
),
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
public async linkCheck(id: string): Promise<MailpitLinkCheckResponse> {
|
|
364
|
-
return this.handleRequest(() =>
|
|
365
|
-
this.axiosInstance.get<MailpitLinkCheckResponse>(
|
|
366
|
-
`/api/v1/message/${id}/link-check`,
|
|
367
|
-
),
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
public async spamAssassinCheck(
|
|
372
|
-
id: string,
|
|
373
|
-
): Promise<MailpitSpamAssassinResponse> {
|
|
374
|
-
return this.handleRequest(() =>
|
|
375
|
-
this.axiosInstance.get<MailpitSpamAssassinResponse>(
|
|
376
|
-
`/api/v1/message/${id}/sa-check`,
|
|
377
|
-
),
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// Messages
|
|
382
|
-
public async listMessages(): Promise<MailpitMessagesSummary> {
|
|
383
|
-
return this.handleRequest(() =>
|
|
384
|
-
this.axiosInstance.get<MailpitMessagesSummary>(`/api/v1/messages`),
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
public async setReadStatus(
|
|
389
|
-
readStatus: MailpitReadStatusRequest,
|
|
390
|
-
): Promise<string> {
|
|
391
|
-
return this.handleRequest(() =>
|
|
392
|
-
this.axiosInstance.put<string>(`/api/v1/messages`, readStatus),
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
public async deleteMessages(
|
|
397
|
-
deleteRequest: MailpitDeleteRequest,
|
|
398
|
-
): Promise<string> {
|
|
399
|
-
return this.handleRequest(() =>
|
|
400
|
-
this.axiosInstance.delete<string>(`/api/v1/messages`, {
|
|
401
|
-
data: deleteRequest,
|
|
402
|
-
}),
|
|
403
|
-
);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// See https://mailpit.axllent.org/docs/usage/search-filters/
|
|
407
|
-
public async searchMessages(
|
|
408
|
-
search: MailpitSearch,
|
|
409
|
-
): Promise<MailpitMessagesSummary> {
|
|
410
|
-
return this.handleRequest(() =>
|
|
411
|
-
this.axiosInstance.put<MailpitMessagesSummary>(`/api/v1/search`, search),
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// See https://mailpit.axllent.org/docs/usage/search-filters/
|
|
416
|
-
public async deleteMessagesBySearch(
|
|
417
|
-
search: MailpitSearchDelete,
|
|
418
|
-
): Promise<string> {
|
|
419
|
-
return this.handleRequest(() =>
|
|
420
|
-
this.axiosInstance.delete<string>(`/api/v1/search`, { data: search }),
|
|
421
|
-
);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// Tags
|
|
425
|
-
public async getTags(): Promise<[string]> {
|
|
426
|
-
return this.handleRequest(() =>
|
|
427
|
-
this.axiosInstance.get<[string]>(`/api/v1/tags`),
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
public async setTags(request: MailpitSetTagsRequest): Promise<string> {
|
|
432
|
-
return this.handleRequest(() =>
|
|
433
|
-
this.axiosInstance.put<string>(`/api/v1/tags`, request),
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
public async renameTag(tag: string, newTagName: string): Promise<string> {
|
|
438
|
-
const encodedTag = encodeURI(tag);
|
|
439
|
-
return this.handleRequest(() =>
|
|
440
|
-
this.axiosInstance.put<string>(`/api/v1/tags/${encodedTag}`, {
|
|
441
|
-
Name: newTagName,
|
|
442
|
-
}),
|
|
443
|
-
);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
public async deleteTag(tag: string): Promise<string> {
|
|
447
|
-
const encodedTag = encodeURI(tag);
|
|
448
|
-
return this.handleRequest(() =>
|
|
449
|
-
this.axiosInstance.delete<string>(`/api/v1/tags/${encodedTag}`),
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// Testing
|
|
454
|
-
public async renderMessageHTML(id: string): Promise<string> {
|
|
455
|
-
return this.handleRequest(() =>
|
|
456
|
-
this.axiosInstance.get<string>(`/view/${id}.html`),
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
public async renderMessageText(id: string): Promise<string> {
|
|
461
|
-
return this.handleRequest(() =>
|
|
462
|
-
this.axiosInstance.get<string>(`/view/${id}.txt`),
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
export default MailpitClient;
|
|
3
|
+
export { MailpitClient };
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"module": "ESNext",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
6
|
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
7
8
|
"strict": true,
|
|
8
9
|
"esModuleInterop": true,
|
|
9
10
|
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"sourceMap": true
|
|
11
14
|
},
|
|
12
|
-
"include": ["src/**/*"
|
|
15
|
+
"include": ["src/**/*"],
|
|
13
16
|
"exclude": ["node_modules", "dist"]
|
|
14
17
|
}
|