relaymail 1.0.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/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +120 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +37 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 RelayMail
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# RelayMail
|
|
2
|
+
|
|
3
|
+
A simple and reliable Node.js client for sending emails through the RelayMail API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install relaymail
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const { RelayMail } = require('relaymail');
|
|
15
|
+
|
|
16
|
+
// Initialize the client
|
|
17
|
+
const relaymail = new RelayMail({
|
|
18
|
+
apiKey: 'your-api-key-here'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Send an email
|
|
22
|
+
async function sendEmail() {
|
|
23
|
+
try {
|
|
24
|
+
const result = await relaymail.send({
|
|
25
|
+
to: 'recipient@example.com',
|
|
26
|
+
subject: 'Hello from RelayMail!',
|
|
27
|
+
body: 'This is a test email sent using the RelayMail npm package.'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log('Email sent successfully!', result);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error('Failed to send email:', error.message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
sendEmail();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## TypeScript Support
|
|
40
|
+
|
|
41
|
+
This package is written in TypeScript and includes full type definitions.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { RelayMail, EmailOptions } from 'relaymail';
|
|
45
|
+
|
|
46
|
+
const relaymail = new RelayMail({
|
|
47
|
+
apiKey: process.env.RELAYMAIL_API_KEY!
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const emailOptions: EmailOptions = {
|
|
51
|
+
to: 'recipient@example.com',
|
|
52
|
+
subject: 'TypeScript Email',
|
|
53
|
+
html: '<h1>Hello from TypeScript!</h1>'
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
await relaymail.send(emailOptions);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## API Reference
|
|
60
|
+
|
|
61
|
+
### Constructor
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
new RelayMail(config: RelayMailConfig)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Parameters:**
|
|
68
|
+
- `config.apiKey` (string, required): Your RelayMail API key
|
|
69
|
+
|
|
70
|
+
### Methods
|
|
71
|
+
|
|
72
|
+
#### `send(options: EmailOptions): Promise<EmailResponse>`
|
|
73
|
+
|
|
74
|
+
Send an email with custom options.
|
|
75
|
+
|
|
76
|
+
**Parameters:**
|
|
77
|
+
- `options.to` (string, required): Recipient email address
|
|
78
|
+
- `options.subject` (string, required): Email subject line
|
|
79
|
+
- `options.body` (string, optional): Plain text email body
|
|
80
|
+
- `options.html` (string, optional): HTML email body
|
|
81
|
+
|
|
82
|
+
**Note:** You must provide at least one of `body` or `html`. You can provide both for a multipart email.
|
|
83
|
+
|
|
84
|
+
**Returns:** Promise resolving to an object with:
|
|
85
|
+
- `id` (number): Email log ID
|
|
86
|
+
- `message` (string): Success message
|
|
87
|
+
|
|
88
|
+
**Example:**
|
|
89
|
+
```javascript
|
|
90
|
+
const result = await relaymail.send({
|
|
91
|
+
to: 'user@example.com',
|
|
92
|
+
subject: 'Welcome!',
|
|
93
|
+
body: 'Plain text content',
|
|
94
|
+
html: '<h1>HTML content</h1>'
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### `sendText(to: string, subject: string, body: string): Promise<EmailResponse>`
|
|
99
|
+
|
|
100
|
+
Convenience method for sending plain text emails.
|
|
101
|
+
|
|
102
|
+
**Example:**
|
|
103
|
+
```javascript
|
|
104
|
+
await relaymail.sendText(
|
|
105
|
+
'user@example.com',
|
|
106
|
+
'Hello',
|
|
107
|
+
'This is a plain text email'
|
|
108
|
+
);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### `sendHtml(to: string, subject: string, html: string): Promise<EmailResponse>`
|
|
112
|
+
|
|
113
|
+
Convenience method for sending HTML emails.
|
|
114
|
+
|
|
115
|
+
**Example:**
|
|
116
|
+
```javascript
|
|
117
|
+
await relaymail.sendHtml(
|
|
118
|
+
'user@example.com',
|
|
119
|
+
'Newsletter',
|
|
120
|
+
'<h1>Welcome to our newsletter!</h1><p>Content here...</p>'
|
|
121
|
+
);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Usage Examples
|
|
125
|
+
|
|
126
|
+
### Sending a Plain Text Email
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
const { RelayMail } = require('relaymail');
|
|
130
|
+
|
|
131
|
+
const client = new RelayMail({ apiKey: 'your-api-key' });
|
|
132
|
+
|
|
133
|
+
await client.sendText(
|
|
134
|
+
'recipient@example.com',
|
|
135
|
+
'Simple Email',
|
|
136
|
+
'This is a simple plain text email.'
|
|
137
|
+
);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Sending an HTML Email
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
await client.sendHtml(
|
|
144
|
+
'recipient@example.com',
|
|
145
|
+
'HTML Newsletter',
|
|
146
|
+
`
|
|
147
|
+
<html>
|
|
148
|
+
<body>
|
|
149
|
+
<h1>Welcome!</h1>
|
|
150
|
+
<p>This is a beautiful HTML email.</p>
|
|
151
|
+
</body>
|
|
152
|
+
</html>
|
|
153
|
+
`
|
|
154
|
+
);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Sending Both Plain Text and HTML
|
|
158
|
+
|
|
159
|
+
```javascript
|
|
160
|
+
await client.send({
|
|
161
|
+
to: 'recipient@example.com',
|
|
162
|
+
subject: 'Multipart Email',
|
|
163
|
+
body: 'This is the plain text version.',
|
|
164
|
+
html: '<h1>This is the HTML version</h1>'
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Error Handling
|
|
169
|
+
|
|
170
|
+
```javascript
|
|
171
|
+
try {
|
|
172
|
+
await client.send({
|
|
173
|
+
to: 'invalid-email',
|
|
174
|
+
subject: 'Test',
|
|
175
|
+
body: 'Content'
|
|
176
|
+
});
|
|
177
|
+
} catch (error) {
|
|
178
|
+
if (error.message.includes('RelayMail Error')) {
|
|
179
|
+
console.error('API Error:', error.message);
|
|
180
|
+
} else if (error.message.includes('Network Error')) {
|
|
181
|
+
console.error('Network issue:', error.message);
|
|
182
|
+
} else {
|
|
183
|
+
console.error('Unexpected error:', error.message);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Using Environment Variables
|
|
189
|
+
|
|
190
|
+
```javascript
|
|
191
|
+
require('dotenv').config();
|
|
192
|
+
|
|
193
|
+
const relaymail = new RelayMail({
|
|
194
|
+
apiKey: process.env.RELAYMAIL_API_KEY
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Getting Your API Key
|
|
199
|
+
|
|
200
|
+
1. Sign up or log in to your RelayMail dashboard
|
|
201
|
+
2. Navigate to the API Keys section
|
|
202
|
+
3. Create a new API key
|
|
203
|
+
4. Copy the key and use it in your application
|
|
204
|
+
|
|
205
|
+
**Important:** Keep your API key secret and never commit it to version control.
|
|
206
|
+
|
|
207
|
+
## Requirements
|
|
208
|
+
|
|
209
|
+
- Node.js >= 14.0.0
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
MIT
|
|
214
|
+
|
|
215
|
+
## Support
|
|
216
|
+
|
|
217
|
+
For issues and questions:
|
|
218
|
+
- GitHub Issues: [Report a bug](https://github.com/AkiTheMemeGod/RelayMail/issues)
|
|
219
|
+
- Email: relaymailingservices@gmail.com
|
|
220
|
+
|
|
221
|
+
## Contributing
|
|
222
|
+
|
|
223
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { EmailOptions, RelayMailConfig, EmailResponse } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* RelayMail Client - Send emails through the RelayMail API
|
|
4
|
+
*/
|
|
5
|
+
export declare class RelayMail {
|
|
6
|
+
private apiKey;
|
|
7
|
+
private client;
|
|
8
|
+
/**
|
|
9
|
+
* Create a new RelayMail client
|
|
10
|
+
* @param config - Configuration object with API key
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const relaymail = new RelayMail({
|
|
14
|
+
* apiKey: 'your-api-key-here'
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
constructor(config: RelayMailConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Send an email
|
|
21
|
+
* @param options - Email options including recipient, subject, and body/html
|
|
22
|
+
* @returns Promise resolving to email response with ID and message
|
|
23
|
+
* @throws Error if the email fails to send
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Send plain text email
|
|
27
|
+
* await relaymail.send({
|
|
28
|
+
* to: 'recipient@example.com',
|
|
29
|
+
* subject: 'Hello World',
|
|
30
|
+
* body: 'This is a plain text email'
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Send HTML email
|
|
34
|
+
* await relaymail.send({
|
|
35
|
+
* to: 'recipient@example.com',
|
|
36
|
+
* subject: 'Hello World',
|
|
37
|
+
* html: '<h1>This is an HTML email</h1>'
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Send email with both plain text and HTML
|
|
41
|
+
* await relaymail.send({
|
|
42
|
+
* to: 'recipient@example.com',
|
|
43
|
+
* subject: 'Hello World',
|
|
44
|
+
* body: 'Plain text version',
|
|
45
|
+
* html: '<h1>HTML version</h1>'
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
send(options: EmailOptions): Promise<EmailResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Send a plain text email (convenience method)
|
|
52
|
+
* @param to - Recipient email address
|
|
53
|
+
* @param subject - Email subject
|
|
54
|
+
* @param body - Plain text email body
|
|
55
|
+
* @returns Promise resolving to email response
|
|
56
|
+
*/
|
|
57
|
+
sendText(to: string, subject: string, body: string): Promise<EmailResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* Send an HTML email (convenience method)
|
|
60
|
+
* @param to - Recipient email address
|
|
61
|
+
* @param subject - Email subject
|
|
62
|
+
* @param html - HTML email body
|
|
63
|
+
* @returns Promise resolving to email response
|
|
64
|
+
*/
|
|
65
|
+
sendHtml(to: string, subject: string, html: string): Promise<EmailResponse>;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAiB,MAAM,SAAS,CAAC;AAEtF;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAgB;IAE9B;;;;;;;;;OASG;gBACS,MAAM,EAAE,eAAe;IAkBnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAmCzD;;;;;;OAMG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjF;;;;;;OAMG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAGlF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RelayMail = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
/**
|
|
9
|
+
* RelayMail Client - Send emails through the RelayMail API
|
|
10
|
+
*/
|
|
11
|
+
class RelayMail {
|
|
12
|
+
/**
|
|
13
|
+
* Create a new RelayMail client
|
|
14
|
+
* @param config - Configuration object with API key
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const relaymail = new RelayMail({
|
|
18
|
+
* apiKey: 'your-api-key-here'
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
constructor(config) {
|
|
23
|
+
if (!config.apiKey) {
|
|
24
|
+
throw new Error('API key is required');
|
|
25
|
+
}
|
|
26
|
+
this.apiKey = config.apiKey;
|
|
27
|
+
const baseUrl = 'https://relaymail.pythonanywhere.com';
|
|
28
|
+
this.client = axios_1.default.create({
|
|
29
|
+
baseURL: baseUrl,
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
'Authorization': `Bearer ${this.apiKey}`
|
|
33
|
+
},
|
|
34
|
+
timeout: 30000 // 30 seconds timeout
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Send an email
|
|
39
|
+
* @param options - Email options including recipient, subject, and body/html
|
|
40
|
+
* @returns Promise resolving to email response with ID and message
|
|
41
|
+
* @throws Error if the email fails to send
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* // Send plain text email
|
|
45
|
+
* await relaymail.send({
|
|
46
|
+
* to: 'recipient@example.com',
|
|
47
|
+
* subject: 'Hello World',
|
|
48
|
+
* body: 'This is a plain text email'
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // Send HTML email
|
|
52
|
+
* await relaymail.send({
|
|
53
|
+
* to: 'recipient@example.com',
|
|
54
|
+
* subject: 'Hello World',
|
|
55
|
+
* html: '<h1>This is an HTML email</h1>'
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Send email with both plain text and HTML
|
|
59
|
+
* await relaymail.send({
|
|
60
|
+
* to: 'recipient@example.com',
|
|
61
|
+
* subject: 'Hello World',
|
|
62
|
+
* body: 'Plain text version',
|
|
63
|
+
* html: '<h1>HTML version</h1>'
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
async send(options) {
|
|
68
|
+
// Validation
|
|
69
|
+
if (!options.to) {
|
|
70
|
+
throw new Error('Recipient email address (to) is required');
|
|
71
|
+
}
|
|
72
|
+
if (!options.subject) {
|
|
73
|
+
throw new Error('Email subject is required');
|
|
74
|
+
}
|
|
75
|
+
if (!options.body && !options.html) {
|
|
76
|
+
throw new Error('Email content is required. Provide either "body" (text) or "html"');
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const response = await this.client.post('/api/v1/send', {
|
|
80
|
+
to: options.to,
|
|
81
|
+
subject: options.subject,
|
|
82
|
+
body: options.body,
|
|
83
|
+
html: options.html
|
|
84
|
+
});
|
|
85
|
+
return response.data;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
89
|
+
const axiosError = error;
|
|
90
|
+
if (axiosError.response?.data?.error) {
|
|
91
|
+
throw new Error(`RelayMail Error: ${axiosError.response.data.error}`);
|
|
92
|
+
}
|
|
93
|
+
throw new Error(`Network Error: ${axiosError.message}`);
|
|
94
|
+
}
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Send a plain text email (convenience method)
|
|
100
|
+
* @param to - Recipient email address
|
|
101
|
+
* @param subject - Email subject
|
|
102
|
+
* @param body - Plain text email body
|
|
103
|
+
* @returns Promise resolving to email response
|
|
104
|
+
*/
|
|
105
|
+
async sendText(to, subject, body) {
|
|
106
|
+
return this.send({ to, subject, body });
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Send an HTML email (convenience method)
|
|
110
|
+
* @param to - Recipient email address
|
|
111
|
+
* @param subject - Email subject
|
|
112
|
+
* @param html - HTML email body
|
|
113
|
+
* @returns Promise resolving to email response
|
|
114
|
+
*/
|
|
115
|
+
async sendHtml(to, subject, html) {
|
|
116
|
+
return this.send({ to, subject, html });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.RelayMail = RelayMail;
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyD;AAGzD;;GAEG;AACH,MAAa,SAAS;IAIpB;;;;;;;;;OASG;IACH,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,MAAM,OAAO,GAAG,sCAAsC,CAAC;QAEvD,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;aACzC;YACD,OAAO,EAAE,KAAK,CAAC,qBAAqB;SACrC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,IAAI,CAAC,OAAqB;QAC9B,aAAa;QACb,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACvF,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAgB,cAAc,EAAE;gBACrE,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,eAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,UAAU,GAAG,KAAkC,CAAC;gBACtD,IAAI,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oBACrC,MAAM,IAAI,KAAK,CAAC,oBAAoB,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;gBACxE,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,kBAAkB,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1D,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAe,EAAE,IAAY;QACtD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAe,EAAE,IAAY;QACtD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAtHD,8BAsHC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RelayMail Email Sending Options
|
|
3
|
+
*/
|
|
4
|
+
export interface EmailOptions {
|
|
5
|
+
/** Recipient email address */
|
|
6
|
+
to: string;
|
|
7
|
+
/** Email subject line */
|
|
8
|
+
subject: string;
|
|
9
|
+
/** Plain text email body (optional if html is provided) */
|
|
10
|
+
body?: string;
|
|
11
|
+
/** HTML email body (optional if body is provided) */
|
|
12
|
+
html?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* RelayMail Client Configuration
|
|
16
|
+
*/
|
|
17
|
+
export interface RelayMailConfig {
|
|
18
|
+
/** Your RelayMail API key */
|
|
19
|
+
apiKey: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Email sending response
|
|
23
|
+
*/
|
|
24
|
+
export interface EmailResponse {
|
|
25
|
+
/** Email log ID */
|
|
26
|
+
id: number;
|
|
27
|
+
/** Success message */
|
|
28
|
+
message: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Error response from the API
|
|
32
|
+
*/
|
|
33
|
+
export interface ErrorResponse {
|
|
34
|
+
/** Error message */
|
|
35
|
+
error: string;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "relaymail",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A simple and reliable email sending client for RelayMail API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepare": "npm run build",
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"email",
|
|
14
|
+
"smtp",
|
|
15
|
+
"mail",
|
|
16
|
+
"relaymail",
|
|
17
|
+
"send-email",
|
|
18
|
+
"email-api"
|
|
19
|
+
],
|
|
20
|
+
"author": "AkiTheMemeGod",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^20.10.0",
|
|
24
|
+
"typescript": "^5.3.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"axios": "^1.6.2"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/yourusername/relaymail"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=14.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|