@arikajs/mail 0.1.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 +290 -0
- package/dist/Contracts/Transport.d.ts +4 -0
- package/dist/Contracts/Transport.d.ts.map +1 -0
- package/dist/Contracts/Transport.js +3 -0
- package/dist/Contracts/Transport.js.map +1 -0
- package/dist/MailManager.d.ts +13 -0
- package/dist/MailManager.d.ts.map +1 -0
- package/dist/MailManager.js +57 -0
- package/dist/MailManager.js.map +1 -0
- package/dist/Mailable.d.ts +21 -0
- package/dist/Mailable.d.ts.map +1 -0
- package/dist/Mailable.js +32 -0
- package/dist/Mailable.js.map +1 -0
- package/dist/Mailer.d.ts +31 -0
- package/dist/Mailer.d.ts.map +1 -0
- package/dist/Mailer.js +89 -0
- package/dist/Mailer.js.map +1 -0
- package/dist/Message.d.ts +45 -0
- package/dist/Message.d.ts.map +1 -0
- package/dist/Message.js +77 -0
- package/dist/Message.js.map +1 -0
- package/dist/Transport/ArrayTransport.d.ts +14 -0
- package/dist/Transport/ArrayTransport.d.ts.map +1 -0
- package/dist/Transport/ArrayTransport.js +25 -0
- package/dist/Transport/ArrayTransport.js.map +1 -0
- package/dist/Transport/LogTransport.d.ts +5 -0
- package/dist/Transport/LogTransport.d.ts.map +1 -0
- package/dist/Transport/LogTransport.js +12 -0
- package/dist/Transport/LogTransport.js.map +1 -0
- package/dist/Transport/SmtpTransport.d.ts +8 -0
- package/dist/Transport/SmtpTransport.d.ts.map +1 -0
- package/dist/Transport/SmtpTransport.js +30 -0
- package/dist/Transport/SmtpTransport.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ArikaJs
|
|
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,290 @@
|
|
|
1
|
+
## Arika Mail
|
|
2
|
+
|
|
3
|
+
`@arikajs/mail` is the email delivery system for the ArikaJS framework.
|
|
4
|
+
|
|
5
|
+
It provides a driver-based, configurable mailer with support for templated emails, attachments, and queue-ready delivery — inspired by Laravel Mail but built natively for Node.js and TypeScript.
|
|
6
|
+
|
|
7
|
+
This package allows applications to send emails without coupling to a specific transport.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- **Multiple mailers**: Configure different mail transports (SMTP)
|
|
14
|
+
- **Driver-based transport system**: Pluggable email backends
|
|
15
|
+
- **Class-based Mailables**: Reusable email classes
|
|
16
|
+
- **Templated emails**: Using `@arikajs/view` for rendering
|
|
17
|
+
- **Attachments**: Via `@arikajs/storage` integration
|
|
18
|
+
- **Plain text & HTML emails**: Support for both formats
|
|
19
|
+
- **Queue-ready architecture**: Designed for async delivery
|
|
20
|
+
- **TypeScript-first**: Full type safety with JavaScript support
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 📦 Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @arikajs/mail
|
|
28
|
+
# or
|
|
29
|
+
yarn add @arikajs/mail
|
|
30
|
+
# or
|
|
31
|
+
pnpm add @arikajs/mail
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🚀 Quick Start
|
|
37
|
+
|
|
38
|
+
### Sending a Basic Email
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { Mail } from '@arikajs/mail';
|
|
42
|
+
|
|
43
|
+
await Mail.to('user@example.com')
|
|
44
|
+
.subject('Welcome')
|
|
45
|
+
.text('Welcome to ArikaJS!')
|
|
46
|
+
.send();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 📬 Using Email Templates
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
await Mail.to('user@example.com')
|
|
55
|
+
.subject('Welcome')
|
|
56
|
+
.view('emails.welcome', { user })
|
|
57
|
+
.send();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Templates are rendered using `@arikajs/view`.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## ✉️ Mailables (Recommended)
|
|
65
|
+
|
|
66
|
+
Mailables provide a clean, reusable way to define emails.
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { Mailable } from '@arikajs/mail';
|
|
70
|
+
|
|
71
|
+
export class WelcomeMail extends Mailable {
|
|
72
|
+
constructor(private user: any) {
|
|
73
|
+
super();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
build() {
|
|
77
|
+
return this
|
|
78
|
+
.subject('Welcome to ArikaJS')
|
|
79
|
+
.view('emails.welcome', { user: this.user });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Sending a mailable:**
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
await Mail.to(user.email).send(new WelcomeMail(user));
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 📎 Attachments
|
|
93
|
+
|
|
94
|
+
Attach files using Arika Storage:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
await Mail.to('user@example.com')
|
|
98
|
+
.subject('Invoice')
|
|
99
|
+
.attach('invoices/2024.pdf')
|
|
100
|
+
.send();
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## ⚙️ Configuration
|
|
106
|
+
|
|
107
|
+
Mail configuration is defined via the application config:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
export default {
|
|
111
|
+
default: process.env.MAIL_MAILER || 'log',
|
|
112
|
+
|
|
113
|
+
mailers: {
|
|
114
|
+
smtp: {
|
|
115
|
+
transport: 'smtp',
|
|
116
|
+
host: process.env.MAIL_HOST || 'smtp.mailtrap.io',
|
|
117
|
+
port: Number(process.env.MAIL_PORT || 587),
|
|
118
|
+
username: process.env.MAIL_USERNAME,
|
|
119
|
+
password: process.env.MAIL_PASSWORD,
|
|
120
|
+
encryption: process.env.MAIL_ENCRYPTION || 'tls',
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
log: {
|
|
124
|
+
transport: 'log',
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
array: {
|
|
128
|
+
transport: 'array',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
from: {
|
|
133
|
+
address: process.env.MAIL_FROM_ADDRESS || 'hello@example.com',
|
|
134
|
+
name: process.env.MAIL_FROM_NAME || 'Example',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 🚚 Supported Transports (v1)
|
|
142
|
+
|
|
143
|
+
| Transport | Status | Description |
|
|
144
|
+
| :--- | :--- | :--- |
|
|
145
|
+
| **SMTP** | ✅ Supported | Standard SMTP delivery |
|
|
146
|
+
| **Log** | ✅ Supported | Logs emails to console (for local dev) |
|
|
147
|
+
| **Array** | ✅ Supported | Stores emails in memory (for testing) |
|
|
148
|
+
| SES | ⏳ Planned | Amazon SES driver |
|
|
149
|
+
| Mailgun | ⏳ Planned | Mailgun API driver |
|
|
150
|
+
| SendGrid | ⏳ Planned | SendGrid API driver |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 📚 API Reference
|
|
155
|
+
|
|
156
|
+
### `Mail.to(address)`
|
|
157
|
+
|
|
158
|
+
Set the recipient email address.
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
Mail.to('user@example.com')
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### `subject(text)`
|
|
165
|
+
|
|
166
|
+
Set the email subject.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
.subject('Welcome')
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `text(content)`
|
|
173
|
+
|
|
174
|
+
Set plain text email content.
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
.text('Plain text email')
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### `view(name, data)`
|
|
181
|
+
|
|
182
|
+
Render an email template.
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
.view('emails.reset', { token })
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### `attach(path)`
|
|
189
|
+
|
|
190
|
+
Attach a file from storage.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
.attach('reports/file.pdf')
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### `send(mailable?)`
|
|
197
|
+
|
|
198
|
+
Send the email.
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
await Mail.to('user@example.com').send();
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
or with a Mailable:
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
await Mail.to(user.email).send(new WelcomeMail(user));
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 🧠 Architecture
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
mail/
|
|
216
|
+
├── src/
|
|
217
|
+
│ ├── MailManager.ts ← Resolves mailers
|
|
218
|
+
│ ├── Mailer.ts ← Sends messages
|
|
219
|
+
│ ├── Message.ts ← Email message builder
|
|
220
|
+
│ ├── Mailable.ts ← Base class for emails
|
|
221
|
+
│ ├── Transport/
|
|
222
|
+
│ │ └── SmtpTransport.ts
|
|
223
|
+
│ ├── Contracts/
|
|
224
|
+
│ │ └── Transport.ts
|
|
225
|
+
│ └── index.ts
|
|
226
|
+
├── tests/
|
|
227
|
+
│ └── Mail.test.ts
|
|
228
|
+
├── package.json
|
|
229
|
+
├── tsconfig.json
|
|
230
|
+
├── README.md
|
|
231
|
+
└── LICENSE
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 🔌 Extending Mail (Custom Transports)
|
|
237
|
+
|
|
238
|
+
Create a custom transport:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { Transport } from '@arikajs/mail';
|
|
242
|
+
|
|
243
|
+
class CustomTransport implements Transport {
|
|
244
|
+
async send(message: any): Promise<void> {
|
|
245
|
+
// Implementation
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Register it with `MailManager`.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 🔗 Integration with ArikaJS
|
|
255
|
+
|
|
256
|
+
`@arikajs/mail` integrates with:
|
|
257
|
+
|
|
258
|
+
- **`@arikajs/view`** → Email templates
|
|
259
|
+
- **`@arikajs/storage`** → Attachments
|
|
260
|
+
- **`@arikajs/queue`** → Async email delivery
|
|
261
|
+
- **`@arikajs/config`** → Mailer configuration
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## 🧪 Testing
|
|
266
|
+
|
|
267
|
+
Mailables and transports can be mocked for testing.
|
|
268
|
+
A log or array transport will be added for test environments.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## 🛣 Roadmap
|
|
273
|
+
|
|
274
|
+
- [ ] Queue-based sending
|
|
275
|
+
- [ ] Markdown email support
|
|
276
|
+
- [ ] Multiple recipients (CC/BCC)
|
|
277
|
+
- [ ] Mail previews
|
|
278
|
+
- [ ] Retry & failure handling
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 📄 License
|
|
283
|
+
|
|
284
|
+
`@arikajs/mail` is open-source software licensed under the **MIT License**.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## 🧭 Philosophy
|
|
289
|
+
|
|
290
|
+
> "Send emails, not headaches."
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transport.d.ts","sourceRoot":"","sources":["../../src/Contracts/Transport.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACtB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transport.js","sourceRoot":"","sources":["../../src/Contracts/Transport.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Mailer, ViewRenderer } from './Mailer';
|
|
2
|
+
export declare class MailManager {
|
|
3
|
+
private config;
|
|
4
|
+
private viewRenderer?;
|
|
5
|
+
private mailers;
|
|
6
|
+
private customCreators;
|
|
7
|
+
constructor(config: any, viewRenderer?: ViewRenderer | undefined);
|
|
8
|
+
extend(driver: string, callback: (config: any) => any): this;
|
|
9
|
+
mailer(name?: string): Mailer;
|
|
10
|
+
protected resolve(name: string): Mailer;
|
|
11
|
+
to(users: any): import("./Mailer").PendingMail;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=MailManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailManager.d.ts","sourceRoot":"","sources":["../src/MailManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKhD,qBAAa,WAAW;IAKR,OAAO,CAAC,MAAM;IAAO,OAAO,CAAC,YAAY,CAAC;IAJtD,OAAO,CAAC,OAAO,CAAkC;IAEjD,OAAO,CAAC,cAAc,CAAgD;gBAElD,MAAM,EAAE,GAAG,EAAU,YAAY,CAAC,EAAE,YAAY,YAAA;IAE7D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG;IAKrD,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IAUpC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IA8BhC,EAAE,CAAC,KAAK,EAAE,GAAG;CAGvB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MailManager = void 0;
|
|
4
|
+
const Mailer_1 = require("./Mailer");
|
|
5
|
+
const SmtpTransport_1 = require("./Transport/SmtpTransport");
|
|
6
|
+
const LogTransport_1 = require("./Transport/LogTransport");
|
|
7
|
+
const ArrayTransport_1 = require("./Transport/ArrayTransport");
|
|
8
|
+
class MailManager {
|
|
9
|
+
constructor(config, viewRenderer) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.viewRenderer = viewRenderer;
|
|
12
|
+
this.mailers = new Map();
|
|
13
|
+
this.customCreators = new Map();
|
|
14
|
+
}
|
|
15
|
+
extend(driver, callback) {
|
|
16
|
+
this.customCreators.set(driver, callback);
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
mailer(name) {
|
|
20
|
+
const mailerName = name || this.config.default;
|
|
21
|
+
if (!this.mailers.has(mailerName)) {
|
|
22
|
+
this.mailers.set(mailerName, this.resolve(mailerName));
|
|
23
|
+
}
|
|
24
|
+
return this.mailers.get(mailerName);
|
|
25
|
+
}
|
|
26
|
+
resolve(name) {
|
|
27
|
+
const config = this.config.mailers[name];
|
|
28
|
+
if (!config) {
|
|
29
|
+
throw new Error(`Mailer [${name}] is not defined.`);
|
|
30
|
+
}
|
|
31
|
+
let transport;
|
|
32
|
+
if (this.customCreators.has(config.transport)) {
|
|
33
|
+
transport = this.customCreators.get(config.transport)(config);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
switch (config.transport) {
|
|
37
|
+
case 'smtp':
|
|
38
|
+
transport = new SmtpTransport_1.SmtpTransport(config);
|
|
39
|
+
break;
|
|
40
|
+
case 'log':
|
|
41
|
+
transport = new LogTransport_1.LogTransport();
|
|
42
|
+
break;
|
|
43
|
+
case 'array':
|
|
44
|
+
transport = new ArrayTransport_1.ArrayTransport();
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
throw new Error(`Unsupported transport driver [${config.transport}].`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return new Mailer_1.Mailer(name, transport, this.viewRenderer);
|
|
51
|
+
}
|
|
52
|
+
to(users) {
|
|
53
|
+
return this.mailer().to(users);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.MailManager = MailManager;
|
|
57
|
+
//# sourceMappingURL=MailManager.js.map
|
|
@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AI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAE,CAAC,MAAM,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACJ,QAAQ,MAAM,CAAC,SAAS,EAAE,CAAC;gBACvB,KAAK,MAAM;oBACP,SAAS,GAAG,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC;oBACtC,MAAM;gBACV,KAAK,KAAK;oBACN,SAAS,GAAG,IAAI,2BAAY,EAAE,CAAC;oBAC/B,MAAM;gBACV,KAAK,OAAO;oBACR,SAAS,GAAG,IAAI,+BAAc,EAAE,CAAC;oBACjC,MAAM;gBACV;oBACI,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;YAC/E,CAAC;QACL,CAAC;QAED,OAAO,IAAI,eAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1D,CAAC;IAEM,EAAE,CAAC,KAAU;QAChB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACJ;AAvDD,kCAuDC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare abstract class Mailable {
|
|
2
|
+
subjectLine?: string;
|
|
3
|
+
viewPath?: string;
|
|
4
|
+
viewData: any;
|
|
5
|
+
textContent?: string;
|
|
6
|
+
attachments: any[];
|
|
7
|
+
fromAddress?: string | {
|
|
8
|
+
name: string;
|
|
9
|
+
address: string;
|
|
10
|
+
};
|
|
11
|
+
abstract build(): this;
|
|
12
|
+
subject(subject: string): this;
|
|
13
|
+
view(path: string, data?: any): this;
|
|
14
|
+
text(content: string): this;
|
|
15
|
+
attach(path: string): this;
|
|
16
|
+
from(address: string | {
|
|
17
|
+
name: string;
|
|
18
|
+
address: string;
|
|
19
|
+
}): this;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Mailable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mailable.d.ts","sourceRoot":"","sources":["../src/Mailable.ts"],"names":[],"mappings":"AACA,8BAAsB,QAAQ;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,GAAG,CAAM;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,GAAG,EAAE,CAAM;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAEhE,QAAQ,CAAC,KAAK,IAAI,IAAI;IAEf,OAAO,CAAC,OAAO,EAAE,MAAM;IAKvB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ;IAMjC,IAAI,CAAC,OAAO,EAAE,MAAM;IAKpB,MAAM,CAAC,IAAI,EAAE,MAAM;IAKnB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAIlE"}
|
package/dist/Mailable.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mailable = void 0;
|
|
4
|
+
class Mailable {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.viewData = {};
|
|
7
|
+
this.attachments = [];
|
|
8
|
+
}
|
|
9
|
+
subject(subject) {
|
|
10
|
+
this.subjectLine = subject;
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
view(path, data = {}) {
|
|
14
|
+
this.viewPath = path;
|
|
15
|
+
this.viewData = data;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
text(content) {
|
|
19
|
+
this.textContent = content;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
attach(path) {
|
|
23
|
+
this.attachments.push({ path });
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
from(address) {
|
|
27
|
+
this.fromAddress = address;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Mailable = Mailable;
|
|
32
|
+
//# sourceMappingURL=Mailable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mailable.js","sourceRoot":"","sources":["../src/Mailable.ts"],"names":[],"mappings":";;;AACA,MAAsB,QAAQ;IAA9B;QAGW,aAAQ,GAAQ,EAAE,CAAC;QAEnB,gBAAW,GAAU,EAAE,CAAC;IA8BnC,CAAC;IAzBU,OAAO,CAAC,OAAe;QAC1B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,IAAI,CAAC,IAAY,EAAE,OAAY,EAAE;QACpC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,IAAI,CAAC,OAAe;QACvB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,IAAY;QACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,IAAI,CAAC,OAAmD;QAC3D,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAnCD,4BAmCC"}
|
package/dist/Mailer.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Transport } from './Contracts/Transport';
|
|
2
|
+
import { Mailable } from './Mailable';
|
|
3
|
+
import { Message, Address } from './Message';
|
|
4
|
+
export interface ViewRenderer {
|
|
5
|
+
render(view: string, data: any): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
export declare class Mailer {
|
|
8
|
+
protected name: string;
|
|
9
|
+
protected transport: Transport;
|
|
10
|
+
protected viewRenderer?: ViewRenderer | undefined;
|
|
11
|
+
constructor(name: string, transport: Transport, viewRenderer?: ViewRenderer | undefined);
|
|
12
|
+
to(users: string | Address | (string | Address)[]): PendingMail;
|
|
13
|
+
send(viewPath: string, data: any, callback: (message: Message) => void): Promise<void>;
|
|
14
|
+
sendMailable(mailable: Mailable): Promise<void>;
|
|
15
|
+
sendRaw(message: any): Promise<void>;
|
|
16
|
+
getRenderer(): ViewRenderer | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare class PendingMail {
|
|
19
|
+
protected mailer: Mailer;
|
|
20
|
+
protected message: Message;
|
|
21
|
+
protected viewPath?: string;
|
|
22
|
+
protected viewData: any;
|
|
23
|
+
constructor(mailer: Mailer);
|
|
24
|
+
to(users: string | Address | (string | Address)[]): this;
|
|
25
|
+
subject(subject: string): this;
|
|
26
|
+
text(content: string): this;
|
|
27
|
+
view(path: string, data?: any): this;
|
|
28
|
+
attach(path: string): this;
|
|
29
|
+
send(mailable?: Mailable): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Mailer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mailer.d.ts","sourceRoot":"","sources":["../src/Mailer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAc,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzD,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpD;AAED,qBAAa,MAAM;IAEX,SAAS,CAAC,IAAI,EAAE,MAAM;IACtB,SAAS,CAAC,SAAS,EAAE,SAAS;IAC9B,SAAS,CAAC,YAAY,CAAC,EAAE,YAAY;gBAF3B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,YAAY,CAAC,EAAE,YAAY,YAAA;IAGzC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE;IAI3C,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;IAYtE,YAAY,CAAC,QAAQ,EAAE,QAAQ;IAI/B,OAAO,CAAC,OAAO,EAAE,GAAG;IAI1B,WAAW;CAGd;AAED,qBAAa,WAAW;IAKR,SAAS,CAAC,MAAM,EAAE,MAAM;IAJpC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAM;gBAEP,MAAM,EAAE,MAAM;IAIpC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE;IAKjD,OAAO,CAAC,OAAO,EAAE,MAAM;IAKvB,IAAI,CAAC,OAAO,EAAE,MAAM;IAKpB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ;IAMjC,MAAM,CAAC,IAAI,EAAE,MAAM;IAKb,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ;CA4BjC"}
|
package/dist/Mailer.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PendingMail = exports.Mailer = void 0;
|
|
4
|
+
const Message_1 = require("./Message");
|
|
5
|
+
class Mailer {
|
|
6
|
+
constructor(name, transport, viewRenderer) {
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.transport = transport;
|
|
9
|
+
this.viewRenderer = viewRenderer;
|
|
10
|
+
}
|
|
11
|
+
to(users) {
|
|
12
|
+
return new PendingMail(this).to(users);
|
|
13
|
+
}
|
|
14
|
+
async send(viewPath, data, callback) {
|
|
15
|
+
const message = new Message_1.Message();
|
|
16
|
+
callback(message);
|
|
17
|
+
if (viewPath && this.viewRenderer) {
|
|
18
|
+
const html = await this.viewRenderer.render(viewPath, data);
|
|
19
|
+
message.htmlContent(html);
|
|
20
|
+
}
|
|
21
|
+
return this.transport.send(message.getPayload());
|
|
22
|
+
}
|
|
23
|
+
async sendMailable(mailable) {
|
|
24
|
+
return this.sendRaw(mailable);
|
|
25
|
+
}
|
|
26
|
+
async sendRaw(message) {
|
|
27
|
+
return this.transport.send(message);
|
|
28
|
+
}
|
|
29
|
+
getRenderer() {
|
|
30
|
+
return this.viewRenderer;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Mailer = Mailer;
|
|
34
|
+
class PendingMail {
|
|
35
|
+
constructor(mailer) {
|
|
36
|
+
this.mailer = mailer;
|
|
37
|
+
this.viewData = {};
|
|
38
|
+
this.message = new Message_1.Message();
|
|
39
|
+
}
|
|
40
|
+
to(users) {
|
|
41
|
+
this.message.to(users);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
subject(subject) {
|
|
45
|
+
this.message.subject(subject);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
text(content) {
|
|
49
|
+
this.message.textContent(content);
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
view(path, data = {}) {
|
|
53
|
+
this.viewPath = path;
|
|
54
|
+
this.viewData = data;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
attach(path) {
|
|
58
|
+
this.message.attach({ path });
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
async send(mailable) {
|
|
62
|
+
if (mailable) {
|
|
63
|
+
mailable.build();
|
|
64
|
+
if (mailable.subjectLine)
|
|
65
|
+
this.message.subject(mailable.subjectLine);
|
|
66
|
+
if (mailable.fromAddress)
|
|
67
|
+
this.message.from(mailable.fromAddress);
|
|
68
|
+
if (mailable.textContent)
|
|
69
|
+
this.message.textContent(mailable.textContent);
|
|
70
|
+
if (mailable.viewPath) {
|
|
71
|
+
this.viewPath = mailable.viewPath;
|
|
72
|
+
this.viewData = mailable.viewData;
|
|
73
|
+
}
|
|
74
|
+
if (mailable.attachments) {
|
|
75
|
+
mailable.attachments.forEach(att => this.message.attach(att));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (this.viewPath) {
|
|
79
|
+
const renderer = this.mailer.getRenderer();
|
|
80
|
+
if (renderer) {
|
|
81
|
+
const html = await renderer.render(this.viewPath, this.viewData);
|
|
82
|
+
this.message.htmlContent(html);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return this.mailer.sendRaw(this.message.getPayload());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.PendingMail = PendingMail;
|
|
89
|
+
//# sourceMappingURL=Mailer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mailer.js","sourceRoot":"","sources":["../src/Mailer.ts"],"names":[],"mappings":";;;AAGA,uCAAyD;AAMzD,MAAa,MAAM;IACf,YACc,IAAY,EACZ,SAAoB,EACpB,YAA2B;QAF3B,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAW;QACpB,iBAAY,GAAZ,YAAY,CAAe;IACrC,CAAC;IAEL,EAAE,CAAC,KAA8C;QAC7C,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAgB,EAAE,IAAS,EAAE,QAAoC;QACxE,MAAM,OAAO,GAAG,IAAI,iBAAO,E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AAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACjE,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1D,CAAC;CACJ;AA/DD,kCA+DC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface Attachment {
|
|
2
|
+
filename?: string;
|
|
3
|
+
path?: string;
|
|
4
|
+
content?: string | Buffer;
|
|
5
|
+
contentType?: string;
|
|
6
|
+
cid?: string;
|
|
7
|
+
encoding?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Address {
|
|
10
|
+
name: string;
|
|
11
|
+
address: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class Message {
|
|
14
|
+
protected _to: (string | Address)[];
|
|
15
|
+
protected _cc: (string | Address)[];
|
|
16
|
+
protected _bcc: (string | Address)[];
|
|
17
|
+
protected _from?: string | Address;
|
|
18
|
+
protected _replyTo?: string | Address;
|
|
19
|
+
protected _subject?: string;
|
|
20
|
+
protected _text?: string;
|
|
21
|
+
protected _html?: string;
|
|
22
|
+
protected _attachments: Attachment[];
|
|
23
|
+
constructor();
|
|
24
|
+
to(address: string | Address | (string | Address)[]): this;
|
|
25
|
+
cc(address: string | Address | (string | Address)[]): this;
|
|
26
|
+
bcc(address: string | Address | (string | Address)[]): this;
|
|
27
|
+
from(address: string | Address): this;
|
|
28
|
+
replyTo(address: string | Address): this;
|
|
29
|
+
subject(subject: string): this;
|
|
30
|
+
textContent(content: string): this;
|
|
31
|
+
htmlContent(content: string): this;
|
|
32
|
+
attach(attachment: Attachment): this;
|
|
33
|
+
getPayload(): {
|
|
34
|
+
to: (string | Address)[];
|
|
35
|
+
cc: (string | Address)[];
|
|
36
|
+
bcc: (string | Address)[];
|
|
37
|
+
from: string | Address | undefined;
|
|
38
|
+
replyTo: string | Address | undefined;
|
|
39
|
+
subject: string | undefined;
|
|
40
|
+
text: string | undefined;
|
|
41
|
+
html: string | undefined;
|
|
42
|
+
attachments: Attachment[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=Message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../src/Message.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,OAAO;IAChB,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAM;IACzC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAM;IACzC,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAM;IAC1C,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,YAAY,EAAE,UAAU,EAAE,CAAM;;IAI1C,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE;IASnD,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE;IASnD,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE;IASpD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAK9B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAKjC,OAAO,CAAC,OAAO,EAAE,MAAM;IAKvB,WAAW,CAAC,OAAO,EAAE,MAAM;IAK3B,WAAW,CAAC,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,UAAU,EAAE,UAAU;IAK7B,UAAU;;;;;;;;;;;CAab"}
|
package/dist/Message.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Message = void 0;
|
|
4
|
+
class Message {
|
|
5
|
+
constructor() {
|
|
6
|
+
this._to = [];
|
|
7
|
+
this._cc = [];
|
|
8
|
+
this._bcc = [];
|
|
9
|
+
this._attachments = [];
|
|
10
|
+
}
|
|
11
|
+
to(address) {
|
|
12
|
+
if (Array.isArray(address)) {
|
|
13
|
+
this._to = this._to.concat(address);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this._to.push(address);
|
|
17
|
+
}
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
cc(address) {
|
|
21
|
+
if (Array.isArray(address)) {
|
|
22
|
+
this._cc = this._cc.concat(address);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this._cc.push(address);
|
|
26
|
+
}
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
bcc(address) {
|
|
30
|
+
if (Array.isArray(address)) {
|
|
31
|
+
this._bcc = this._bcc.concat(address);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this._bcc.push(address);
|
|
35
|
+
}
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
from(address) {
|
|
39
|
+
this._from = address;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
replyTo(address) {
|
|
43
|
+
this._replyTo = address;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
subject(subject) {
|
|
47
|
+
this._subject = subject;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
textContent(content) {
|
|
51
|
+
this._text = content;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
htmlContent(content) {
|
|
55
|
+
this._html = content;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
attach(attachment) {
|
|
59
|
+
this._attachments.push(attachment);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
getPayload() {
|
|
63
|
+
return {
|
|
64
|
+
to: this._to,
|
|
65
|
+
cc: this._cc,
|
|
66
|
+
bcc: this._bcc,
|
|
67
|
+
from: this._from,
|
|
68
|
+
replyTo: this._replyTo,
|
|
69
|
+
subject: this._subject,
|
|
70
|
+
text: this._text,
|
|
71
|
+
html: this._html,
|
|
72
|
+
attachments: this._attachments,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.Message = Message;
|
|
77
|
+
//# sourceMappingURL=Message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../src/Message.ts"],"names":[],"mappings":";;;AAeA,MAAa,OAAO;IAWhB;QAVU,QAAG,GAAyB,EAAE,CAAC;QAC/B,QAAG,GAAyB,EAAE,CAAC;QAC/B,SAAI,GAAyB,EAAE,CAAC;QAMhC,iBAAY,GAAiB,EAAE,CAAC;IAE1B,CAAC;IAEjB,EAAE,CAAC,OAAgD;QAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,C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AAC;IAChB,CAAC;IAED,WAAW,CAAC,OAAe;QACvB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,UAAsB;QACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU;QACN,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,GAAG,EAAE,IAAI,CAAC,IAAI;YACd,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,WAAW,EAAE,IAAI,CAAC,YAAY;SACjC,CAAC;IACN,CAAC;CACJ;AAnFD,0BAmFC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Transport } from '../Contracts/Transport';
|
|
2
|
+
export declare class ArrayTransport implements Transport {
|
|
3
|
+
messages: any[];
|
|
4
|
+
send(message: any): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Clear all stored messages.
|
|
7
|
+
*/
|
|
8
|
+
clear(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Get all stored messages.
|
|
11
|
+
*/
|
|
12
|
+
getMessages(): any[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ArrayTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayTransport.d.ts","sourceRoot":"","sources":["../../src/Transport/ArrayTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,qBAAa,cAAe,YAAW,SAAS;IACrC,QAAQ,EAAE,GAAG,EAAE,CAAM;IAEtB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;OAEG;IACI,WAAW,IAAI,GAAG,EAAE;CAG9B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayTransport = void 0;
|
|
4
|
+
class ArrayTransport {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.messages = [];
|
|
7
|
+
}
|
|
8
|
+
async send(message) {
|
|
9
|
+
this.messages.push(message);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Clear all stored messages.
|
|
13
|
+
*/
|
|
14
|
+
clear() {
|
|
15
|
+
this.messages = [];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get all stored messages.
|
|
19
|
+
*/
|
|
20
|
+
getMessages() {
|
|
21
|
+
return this.messages;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ArrayTransport = ArrayTransport;
|
|
25
|
+
//# sourceMappingURL=ArrayTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayTransport.js","sourceRoot":"","sources":["../../src/Transport/ArrayTransport.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAA3B;QACW,aAAQ,GAAU,EAAE,CAAC;IAmBhC,CAAC;IAjBG,KAAK,CAAC,IAAI,CAAC,OAAY;QACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,KAAK;QACR,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,WAAW;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CACJ;AApBD,wCAoBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogTransport.d.ts","sourceRoot":"","sources":["../../src/Transport/LogTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,qBAAa,YAAa,YAAW,SAAS;IACpC,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAK1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogTransport = void 0;
|
|
4
|
+
class LogTransport {
|
|
5
|
+
async send(message) {
|
|
6
|
+
console.log('--- Email Sent ---');
|
|
7
|
+
console.log(JSON.stringify(message, null, 2));
|
|
8
|
+
console.log('------------------');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.LogTransport = LogTransport;
|
|
12
|
+
//# sourceMappingURL=LogTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogTransport.js","sourceRoot":"","sources":["../../src/Transport/LogTransport.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IACrB,KAAK,CAAC,IAAI,CAAC,OAAY;QACnB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;CACJ;AAND,oCAMC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Transport } from '../Contracts/Transport';
|
|
2
|
+
import { Transporter } from 'nodemailer';
|
|
3
|
+
export declare class SmtpTransport implements Transport {
|
|
4
|
+
protected transporter: Transporter;
|
|
5
|
+
constructor(config: any);
|
|
6
|
+
send(message: any): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=SmtpTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmtpTransport.d.ts","sourceRoot":"","sources":["../../src/Transport/SmtpTransport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAmB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD,qBAAa,aAAc,YAAW,SAAS;IAC3C,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;gBAIvB,MAAM,EAAE,GAAG;IAoBjB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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.SmtpTransport = void 0;
|
|
7
|
+
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
8
|
+
class SmtpTransport {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
const options = {
|
|
11
|
+
host: config.host,
|
|
12
|
+
port: config.port,
|
|
13
|
+
secure: config.encryption === 'ssl',
|
|
14
|
+
auth: {
|
|
15
|
+
user: config.username,
|
|
16
|
+
pass: config.password,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const defaults = {};
|
|
20
|
+
if (config.from) {
|
|
21
|
+
defaults.from = config.from;
|
|
22
|
+
}
|
|
23
|
+
this.transporter = nodemailer_1.default.createTransport(options, defaults);
|
|
24
|
+
}
|
|
25
|
+
async send(message) {
|
|
26
|
+
return await this.transporter.sendMail(message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.SmtpTransport = SmtpTransport;
|
|
30
|
+
//# sourceMappingURL=SmtpTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmtpTransport.js","sourceRoot":"","sources":["../../src/Transport/SmtpTransport.ts"],"names":[],"mappings":";;;;;;AAEA,4DAAqD;AAErD,MAAa,aAAa;IAKtB,YAAY,MAAW;QACnB,MAAM,OAAO,GAAQ;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,UAAU,KAAK,KAAK;YACnC,IAAI,EAAE;gBACF,IAAI,EAAE,MAAM,CAAC,QAAQ;gBACrB,IAAI,EAAE,MAAM,CAAC,QAAQ;aACxB;SACJ,CAAC;QAEF,MAAM,QAAQ,GAAQ,EAAE,CAAC;QACzB,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACd,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QAChC,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,oBAAU,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC;IAGD,KAAK,CAAC,IAAI,CAAC,OAAY;QACnB,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACJ;AA5BD,sCA4BC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MailManager } from './MailManager';
|
|
2
|
+
export { MailManager } from './MailManager';
|
|
3
|
+
export { Mailer, PendingMail, ViewRenderer } from './Mailer';
|
|
4
|
+
export { Mailable } from './Mailable';
|
|
5
|
+
export { Message, Attachment, Address } from './Message';
|
|
6
|
+
export { Transport } from './Contracts/Transport';
|
|
7
|
+
export { SmtpTransport } from './Transport/SmtpTransport';
|
|
8
|
+
export declare class Mail {
|
|
9
|
+
static setManager(manager: MailManager): void;
|
|
10
|
+
static extend(driver: string, callback: (config: any) => any): MailManager;
|
|
11
|
+
static to(users: any): import("./Mailer").PendingMail;
|
|
12
|
+
static mailer(name?: string): import("./Mailer").Mailer;
|
|
13
|
+
}
|
|
14
|
+
//# 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,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAI1D,qBAAa,IAAI;IACb,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW;IAItC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG;IAO5D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG;IAOpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM;CAM9B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mail = exports.SmtpTransport = exports.Message = exports.Mailable = exports.PendingMail = exports.Mailer = exports.MailManager = void 0;
|
|
4
|
+
var MailManager_1 = require("./MailManager");
|
|
5
|
+
Object.defineProperty(exports, "MailManager", { enumerable: true, get: function () { return MailManager_1.MailManager; } });
|
|
6
|
+
var Mailer_1 = require("./Mailer");
|
|
7
|
+
Object.defineProperty(exports, "Mailer", { enumerable: true, get: function () { return Mailer_1.Mailer; } });
|
|
8
|
+
Object.defineProperty(exports, "PendingMail", { enumerable: true, get: function () { return Mailer_1.PendingMail; } });
|
|
9
|
+
var Mailable_1 = require("./Mailable");
|
|
10
|
+
Object.defineProperty(exports, "Mailable", { enumerable: true, get: function () { return Mailable_1.Mailable; } });
|
|
11
|
+
var Message_1 = require("./Message");
|
|
12
|
+
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return Message_1.Message; } });
|
|
13
|
+
var SmtpTransport_1 = require("./Transport/SmtpTransport");
|
|
14
|
+
Object.defineProperty(exports, "SmtpTransport", { enumerable: true, get: function () { return SmtpTransport_1.SmtpTransport; } });
|
|
15
|
+
let mailManager;
|
|
16
|
+
class Mail {
|
|
17
|
+
static setManager(manager) {
|
|
18
|
+
mailManager = manager;
|
|
19
|
+
}
|
|
20
|
+
static extend(driver, callback) {
|
|
21
|
+
if (!mailManager) {
|
|
22
|
+
throw new Error('Mail system not configured. Please use Mail.setManager() to configure.');
|
|
23
|
+
}
|
|
24
|
+
return mailManager.extend(driver, callback);
|
|
25
|
+
}
|
|
26
|
+
static to(users) {
|
|
27
|
+
if (!mailManager) {
|
|
28
|
+
throw new Error('Mail system not configured. Please use Mail.setManager() to configure.');
|
|
29
|
+
}
|
|
30
|
+
return mailManager.to(users);
|
|
31
|
+
}
|
|
32
|
+
static mailer(name) {
|
|
33
|
+
if (!mailManager) {
|
|
34
|
+
throw new Error('Mail system not configured. Please use Mail.setManager() to configure.');
|
|
35
|
+
}
|
|
36
|
+
return mailManager.mailer(name);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Mail = Mail;
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAGA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mCAA6D;AAApD,gGAAA,MAAM,OAAA;AAAE,qGAAA,WAAW,OAAA;AAC5B,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,qCAAyD;AAAhD,kGAAA,OAAO,OAAA;AAEhB,2DAA0D;AAAjD,8GAAA,aAAa,OAAA;AAEtB,IAAI,WAAwB,CAAC;AAE7B,MAAa,IAAI;IACb,MAAM,CAAC,UAAU,CAAC,OAAoB;QAClC,WAAW,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,MAAc,EAAE,QAA8B;QACxD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,KAAU;QAChB,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,IAAa;QACvB,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACJ;AAzBD,oBAyBC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arikajs/mail",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Email delivery system for the ArikaJS framework.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc -p tsconfig.json",
|
|
10
|
+
"build:tests": "tsc -p tsconfig.test.json",
|
|
11
|
+
"clean": "rm -rf dist",
|
|
12
|
+
"prepare": "echo skip",
|
|
13
|
+
"test": "npm run build && npm run build:tests && node scripts/fix-test-imports.js && node --test 'dist/tests/**/*.test.js'",
|
|
14
|
+
"test:watch": "npm run build && npm run build:tests && node --test --watch 'dist/tests/**/*.test.js'"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"arika",
|
|
21
|
+
"arika-js",
|
|
22
|
+
"framework",
|
|
23
|
+
"mail",
|
|
24
|
+
"email",
|
|
25
|
+
"smtp",
|
|
26
|
+
"mailer",
|
|
27
|
+
"mailable"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20.0.0"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/arikajs/mail.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/arikajs/mail/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/arikajs/mail#readme",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"nodemailer": "^6.9.8"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^20.11.24",
|
|
45
|
+
"@types/nodemailer": "^6.4.14",
|
|
46
|
+
"typescript": "^5.3.3"
|
|
47
|
+
},
|
|
48
|
+
"author": "Prakash Tank"
|
|
49
|
+
}
|