@arikajs/mail 0.0.4 → 0.0.5
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/README.md +80 -16
- package/dist/Jobs/SendQueuedMailable.d.ts +8 -0
- package/dist/Jobs/SendQueuedMailable.d.ts.map +1 -0
- package/dist/Jobs/SendQueuedMailable.js +32 -0
- package/dist/Jobs/SendQueuedMailable.js.map +1 -0
- package/dist/MailManager.d.ts +3 -0
- package/dist/MailManager.d.ts.map +1 -1
- package/dist/MailManager.js +8 -1
- package/dist/MailManager.js.map +1 -1
- package/dist/Mailable.d.ts +44 -1
- package/dist/Mailable.d.ts.map +1 -1
- package/dist/Mailable.js +44 -2
- package/dist/Mailable.js.map +1 -1
- package/dist/Mailer.d.ts +14 -2
- package/dist/Mailer.d.ts.map +1 -1
- package/dist/Mailer.js +101 -4
- package/dist/Mailer.js.map +1 -1
- package/dist/Message.d.ts +3 -1
- package/dist/Message.d.ts.map +1 -1
- package/dist/Message.js +14 -0
- package/dist/Message.js.map +1 -1
- package/dist/Transport/LogTransport.d.ts.map +1 -1
- package/dist/Transport/LogTransport.js +26 -3
- package/dist/Transport/LogTransport.js.map +1 -1
- package/dist/Transport/SesTransport.d.ts.map +1 -1
- package/dist/Transport/SesTransport.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/package.json +52 -50
- package/dist/src/Contracts/Transport.d.ts +0 -4
- package/dist/src/Contracts/Transport.d.ts.map +0 -1
- package/dist/src/Contracts/Transport.js +0 -3
- package/dist/src/Contracts/Transport.js.map +0 -1
- package/dist/src/MailManager.d.ts +0 -13
- package/dist/src/MailManager.d.ts.map +0 -1
- package/dist/src/MailManager.js +0 -69
- package/dist/src/MailManager.js.map +0 -1
- package/dist/src/Mailable.d.ts +0 -21
- package/dist/src/Mailable.d.ts.map +0 -1
- package/dist/src/Mailable.js +0 -32
- package/dist/src/Mailable.js.map +0 -1
- package/dist/src/Mailer.d.ts +0 -31
- package/dist/src/Mailer.d.ts.map +0 -1
- package/dist/src/Mailer.js +0 -89
- package/dist/src/Mailer.js.map +0 -1
- package/dist/src/Message.d.ts +0 -45
- package/dist/src/Message.d.ts.map +0 -1
- package/dist/src/Message.js +0 -77
- package/dist/src/Message.js.map +0 -1
- package/dist/src/Transport/ArrayTransport.d.ts +0 -14
- package/dist/src/Transport/ArrayTransport.d.ts.map +0 -1
- package/dist/src/Transport/ArrayTransport.js +0 -25
- package/dist/src/Transport/ArrayTransport.js.map +0 -1
- package/dist/src/Transport/LogTransport.d.ts +0 -5
- package/dist/src/Transport/LogTransport.d.ts.map +0 -1
- package/dist/src/Transport/LogTransport.js +0 -12
- package/dist/src/Transport/LogTransport.js.map +0 -1
- package/dist/src/Transport/MailgunTransport.d.ts +0 -8
- package/dist/src/Transport/MailgunTransport.d.ts.map +0 -1
- package/dist/src/Transport/MailgunTransport.js +0 -24
- package/dist/src/Transport/MailgunTransport.js.map +0 -1
- package/dist/src/Transport/SendGridTransport.d.ts +0 -8
- package/dist/src/Transport/SendGridTransport.d.ts.map +0 -1
- package/dist/src/Transport/SendGridTransport.js +0 -22
- package/dist/src/Transport/SendGridTransport.js.map +0 -1
- package/dist/src/Transport/SesTransport.d.ts +0 -8
- package/dist/src/Transport/SesTransport.d.ts.map +0 -1
- package/dist/src/Transport/SesTransport.js +0 -28
- package/dist/src/Transport/SesTransport.js.map +0 -1
- package/dist/src/Transport/SmtpTransport.d.ts +0 -8
- package/dist/src/Transport/SmtpTransport.d.ts.map +0 -1
- package/dist/src/Transport/SmtpTransport.js +0 -30
- package/dist/src/Transport/SmtpTransport.js.map +0 -1
- package/dist/src/index.d.ts +0 -17
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -46
- package/dist/src/index.js.map +0 -1
- package/dist/tests/Mail.test.d.ts +0 -2
- package/dist/tests/Mail.test.d.ts.map +0 -1
- package/dist/tests/Mail.test.js +0 -43
- package/dist/tests/Mail.test.js.map +0 -1
- package/dist/tests/TransportResolution.test.d.ts +0 -2
- package/dist/tests/TransportResolution.test.d.ts.map +0 -1
- package/dist/tests/TransportResolution.test.js +0 -52
- package/dist/tests/TransportResolution.test.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`@arikajs/mail` is the email delivery system for the ArikaJS framework.
|
|
4
4
|
|
|
5
|
-
It provides a driver-based, configurable mailer with support for templated emails, attachments, and queue-ready delivery —
|
|
5
|
+
It provides a driver-based, configurable mailer with support for templated emails, attachments, and queue-ready delivery — with a beautiful, expressive API but built natively for Node.js and TypeScript.
|
|
6
6
|
|
|
7
7
|
This package allows applications to send emails without coupling to a specific transport.
|
|
8
8
|
|
|
@@ -15,8 +15,9 @@ This package allows applications to send emails without coupling to a specific t
|
|
|
15
15
|
- **Class-based Mailables**: Reusable email classes
|
|
16
16
|
- **Templated emails**: Using `@arikajs/view` for rendering
|
|
17
17
|
- **Attachments**: Via `@arikajs/storage` integration
|
|
18
|
+
- **Multiple Recipients**: Full support for `to`, `cc`, and `bcc`
|
|
19
|
+
- **Queue-ready**: Native async delivery via `@arikajs/queue`
|
|
18
20
|
- **Plain text & HTML emails**: Support for both formats
|
|
19
|
-
- **Queue-ready architecture**: Designed for async delivery
|
|
20
21
|
- **TypeScript-first**: Full type safety with JavaScript support
|
|
21
22
|
|
|
22
23
|
---
|
|
@@ -87,9 +88,15 @@ export class WelcomeMail extends Mailable {
|
|
|
87
88
|
await Mail.to(user.email).send(new WelcomeMail(user));
|
|
88
89
|
```
|
|
89
90
|
|
|
91
|
+
**Queuing a mailable:**
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
await Mail.to(user.email).queue(new WelcomeMail(user));
|
|
95
|
+
```
|
|
96
|
+
|
|
90
97
|
---
|
|
91
98
|
|
|
92
|
-
|
|
99
|
+
### Attachments
|
|
93
100
|
|
|
94
101
|
Attach files using Arika Storage:
|
|
95
102
|
|
|
@@ -100,6 +107,50 @@ await Mail.to('user@example.com')
|
|
|
100
107
|
.send();
|
|
101
108
|
```
|
|
102
109
|
|
|
110
|
+
**From raw data (Buffer):**
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
const buffer = await generatePdf(data);
|
|
114
|
+
|
|
115
|
+
await Mail.to('user@example.com')
|
|
116
|
+
.attachData(buffer, 'invoice.pdf')
|
|
117
|
+
.send();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**From streams:**
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
const stream = getDynamicReportStream();
|
|
124
|
+
|
|
125
|
+
await Mail.to('user@example.com')
|
|
126
|
+
.attachStream(stream, 'report.csv')
|
|
127
|
+
.send();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Multiple Recipients
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
await Mail.to('user@example.com')
|
|
134
|
+
.cc(['manager@example.com', 'admin@example.com'])
|
|
135
|
+
.bcc('audit@example.com')
|
|
136
|
+
.subject('Notification')
|
|
137
|
+
.send();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Queued Delivery
|
|
141
|
+
|
|
142
|
+
Arika Mail integrates with `@arikajs/queue` for background processing.
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
import { Queue } from '@arikajs/queue';
|
|
146
|
+
|
|
147
|
+
// Configure queue on the mail system
|
|
148
|
+
Mail.setQueue(queueManager);
|
|
149
|
+
|
|
150
|
+
// Dispatch to background
|
|
151
|
+
await Mail.to('user@example.com').queue(new WelcomeMail(user));
|
|
152
|
+
```
|
|
153
|
+
|
|
103
154
|
---
|
|
104
155
|
|
|
105
156
|
## ⚙️ Configuration
|
|
@@ -161,6 +212,14 @@ Set the recipient email address.
|
|
|
161
212
|
Mail.to('user@example.com')
|
|
162
213
|
```
|
|
163
214
|
|
|
215
|
+
### `replyTo(address)`
|
|
216
|
+
|
|
217
|
+
Set the Reply-To address.
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
.replyTo('support@example.com')
|
|
221
|
+
```
|
|
222
|
+
|
|
164
223
|
### `subject(text)`
|
|
165
224
|
|
|
166
225
|
Set the email subject.
|
|
@@ -209,26 +268,31 @@ await Mail.to(user.email).send(new WelcomeMail(user));
|
|
|
209
268
|
|
|
210
269
|
---
|
|
211
270
|
|
|
212
|
-
##
|
|
271
|
+
## 🏗 Architecture
|
|
213
272
|
|
|
214
|
-
```
|
|
273
|
+
```text
|
|
215
274
|
mail/
|
|
216
275
|
├── src/
|
|
217
|
-
│ ├──
|
|
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/
|
|
276
|
+
│ ├── Contracts
|
|
224
277
|
│ │ └── Transport.ts
|
|
225
|
-
│
|
|
278
|
+
│ ├── Jobs
|
|
279
|
+
│ │ └── SendQueuedMailable.ts
|
|
280
|
+
│ ├── Transport
|
|
281
|
+
│ │ ├── ArrayTransport.ts
|
|
282
|
+
│ │ ├── LogTransport.ts
|
|
283
|
+
│ │ ├── MailgunTransport.ts
|
|
284
|
+
│ │ ├── SendGridTransport.ts
|
|
285
|
+
│ │ ├── SesTransport.ts
|
|
286
|
+
│ │ └── SmtpTransport.ts
|
|
287
|
+
│ ├── index.ts
|
|
288
|
+
│ ├── Mailable.ts
|
|
289
|
+
│ ├── Mailer.ts
|
|
290
|
+
│ ├── MailManager.ts
|
|
291
|
+
│ └── Message.ts
|
|
226
292
|
├── tests/
|
|
227
|
-
│ └── Mail.test.ts
|
|
228
293
|
├── package.json
|
|
229
294
|
├── tsconfig.json
|
|
230
|
-
|
|
231
|
-
└── LICENSE
|
|
295
|
+
└── README.md
|
|
232
296
|
```
|
|
233
297
|
|
|
234
298
|
---
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseJob } from '@arikajs/queue';
|
|
2
|
+
export declare class SendQueuedMailable extends BaseJob {
|
|
3
|
+
mailable: any;
|
|
4
|
+
mailerName?: string | undefined;
|
|
5
|
+
constructor(mailable: any, mailerName?: string | undefined);
|
|
6
|
+
handle(): Promise<any>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=SendQueuedMailable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SendQueuedMailable.d.ts","sourceRoot":"","sources":["../../src/Jobs/SendQueuedMailable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,kBAAmB,SAAQ,OAAO;IAEhC,QAAQ,EAAE,GAAG;IACb,UAAU,CAAC,EAAE,MAAM;gBADnB,QAAQ,EAAE,GAAG,EACb,UAAU,CAAC,EAAE,MAAM,YAAA;IAKxB,MAAM;CAqBf"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SendQueuedMailable = void 0;
|
|
4
|
+
const queue_1 = require("@arikajs/queue");
|
|
5
|
+
class SendQueuedMailable extends queue_1.BaseJob {
|
|
6
|
+
constructor(mailable, mailerName) {
|
|
7
|
+
super();
|
|
8
|
+
this.mailable = mailable;
|
|
9
|
+
this.mailerName = mailerName;
|
|
10
|
+
}
|
|
11
|
+
async handle() {
|
|
12
|
+
// Resolve mail manager from container
|
|
13
|
+
const { app } = require('arikajs');
|
|
14
|
+
const mailManager = app().make('mail');
|
|
15
|
+
const mailer = mailManager.mailer(this.mailerName);
|
|
16
|
+
// If it's a mailable instance/payload
|
|
17
|
+
if (this.mailable && (this.mailable.toRecipients || this.mailable.viewPath)) {
|
|
18
|
+
let pending = mailer.to(this.mailable.toRecipients || []);
|
|
19
|
+
if (this.mailable.ccRecipients && this.mailable.ccRecipients.length > 0) {
|
|
20
|
+
pending = pending.cc(this.mailable.ccRecipients);
|
|
21
|
+
}
|
|
22
|
+
if (this.mailable.bccRecipients && this.mailable.bccRecipients.length > 0) {
|
|
23
|
+
pending = pending.bcc(this.mailable.bccRecipients);
|
|
24
|
+
}
|
|
25
|
+
return pending.send(this.mailable);
|
|
26
|
+
}
|
|
27
|
+
// Ensure recipients are handled if they were set on the PendingMail before queue()
|
|
28
|
+
return mailer.sendMailable(this.mailable);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.SendQueuedMailable = SendQueuedMailable;
|
|
32
|
+
//# sourceMappingURL=SendQueuedMailable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SendQueuedMailable.js","sourceRoot":"","sources":["../../src/Jobs/SendQueuedMailable.ts"],"names":[],"mappings":";;;AAAA,0CAAyC;AAEzC,MAAa,kBAAmB,SAAQ,eAAO;IAC3C,YACW,QAAa,EACb,UAAmB;QAE1B,KAAK,EAAE,CAAC;QAHD,aAAQ,GAAR,QAAQ,CAAK;QACb,eAAU,GAAV,UAAU,CAAS;IAG9B,CAAC;IAED,KAAK,CAAC,MAAM;QACR,sCAAsC;QACtC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEnD,sCAAsC;QACtC,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1E,IAAI,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;YAC1D,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtE,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACrD,CAAC;YACD,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,mFAAmF;QACnF,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;CACJ;AA7BD,gDA6BC"}
|
package/dist/MailManager.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ export declare class MailManager {
|
|
|
4
4
|
private viewRenderer?;
|
|
5
5
|
private mailers;
|
|
6
6
|
private customCreators;
|
|
7
|
+
private queue;
|
|
7
8
|
constructor(config: any, viewRenderer?: ViewRenderer | undefined);
|
|
9
|
+
setQueue(queue: any): this;
|
|
10
|
+
getQueue(): any;
|
|
8
11
|
extend(driver: string, callback: (config: any) => any): this;
|
|
9
12
|
mailer(name?: string): Mailer;
|
|
10
13
|
protected resolve(name: string): Mailer;
|
|
@@ -1 +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;
|
|
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;IAMR,OAAO,CAAC,MAAM;IAAO,OAAO,CAAC,YAAY,CAAC;IALtD,OAAO,CAAC,OAAO,CAAkC;IAEjD,OAAO,CAAC,cAAc,CAAgD;IACtE,OAAO,CAAC,KAAK,CAAM;gBAEC,MAAM,EAAE,GAAG,EAAU,YAAY,CAAC,EAAE,YAAY,YAAA;IAE7D,QAAQ,CAAC,KAAK,EAAE,GAAG;IAKnB,QAAQ;IAIR,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;IA0ChC,EAAE,CAAC,KAAK,EAAE,GAAG;CAGvB"}
|
package/dist/MailManager.js
CHANGED
|
@@ -12,6 +12,13 @@ class MailManager {
|
|
|
12
12
|
this.mailers = new Map();
|
|
13
13
|
this.customCreators = new Map();
|
|
14
14
|
}
|
|
15
|
+
setQueue(queue) {
|
|
16
|
+
this.queue = queue;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
getQueue() {
|
|
20
|
+
return this.queue;
|
|
21
|
+
}
|
|
15
22
|
extend(driver, callback) {
|
|
16
23
|
this.customCreators.set(driver, callback);
|
|
17
24
|
return this;
|
|
@@ -59,7 +66,7 @@ class MailManager {
|
|
|
59
66
|
throw new Error(`Unsupported transport driver [${config.transport}].`);
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
|
-
return new Mailer_1.Mailer(name, transport, this.viewRenderer);
|
|
69
|
+
return new Mailer_1.Mailer(name, transport, this.viewRenderer, this);
|
|
63
70
|
}
|
|
64
71
|
to(users) {
|
|
65
72
|
return this.mailer().to(users);
|
package/dist/MailManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MailManager.js","sourceRoot":"","sources":["../src/MailManager.ts"],"names":[],"mappings":";;;AACA,qCAAgD;AAChD,6DAA0D;AAC1D,2DAAwD;AACxD,+DAA4D;AAE5D,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"MailManager.js","sourceRoot":"","sources":["../src/MailManager.ts"],"names":[],"mappings":";;;AACA,qCAAgD;AAChD,6DAA0D;AAC1D,2DAAwD;AACxD,+DAA4D;AAE5D,MAAa,WAAW;IAMpB,YAAoB,MAAW,EAAU,YAA2B;QAAhD,WAAM,GAAN,MAAM,CAAK;QAAU,iBAAY,GAAZ,YAAY,CAAe;QAL5D,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;QAEzC,mBAAc,GAAsC,IAAI,GAAG,EAAE,CAAC;IAGE,CAAC;IAElE,QAAQ,CAAC,KAAU;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,MAAc,EAAE,QAA8B;QACxD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,IAAa;QACvB,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;IACzC,CAAC;IAES,OAAO,CAAC,IAAY;QAC1B,MAAM,MAAM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I,CAAC,CAAC;YAC/E,CAAC;QACL,CAAC;QAED,OAAO,IAAI,eAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IAEM,EAAE,CAAC,KAAU;QAChB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACJ;AA7ED,kCA6EC"}
|
package/dist/Mailable.d.ts
CHANGED
|
@@ -8,14 +8,57 @@ export declare abstract class Mailable {
|
|
|
8
8
|
name: string;
|
|
9
9
|
address: string;
|
|
10
10
|
};
|
|
11
|
+
replyToAddress?: string | {
|
|
12
|
+
name: string;
|
|
13
|
+
address: string;
|
|
14
|
+
};
|
|
15
|
+
toRecipients: (string | {
|
|
16
|
+
name: string;
|
|
17
|
+
address: string;
|
|
18
|
+
})[];
|
|
19
|
+
ccRecipients: (string | {
|
|
20
|
+
name: string;
|
|
21
|
+
address: string;
|
|
22
|
+
})[];
|
|
23
|
+
bccRecipients: (string | {
|
|
24
|
+
name: string;
|
|
25
|
+
address: string;
|
|
26
|
+
})[];
|
|
11
27
|
abstract build(): this;
|
|
28
|
+
to(address: string | {
|
|
29
|
+
name: string;
|
|
30
|
+
address: string;
|
|
31
|
+
} | (string | {
|
|
32
|
+
name: string;
|
|
33
|
+
address: string;
|
|
34
|
+
})[]): this;
|
|
35
|
+
cc(address: string | {
|
|
36
|
+
name: string;
|
|
37
|
+
address: string;
|
|
38
|
+
} | (string | {
|
|
39
|
+
name: string;
|
|
40
|
+
address: string;
|
|
41
|
+
})[]): this;
|
|
42
|
+
bcc(address: string | {
|
|
43
|
+
name: string;
|
|
44
|
+
address: string;
|
|
45
|
+
} | (string | {
|
|
46
|
+
name: string;
|
|
47
|
+
address: string;
|
|
48
|
+
})[]): this;
|
|
12
49
|
subject(subject: string): this;
|
|
13
50
|
view(path: string, data?: any): this;
|
|
14
51
|
text(content: string): this;
|
|
15
|
-
attach(path: string): this;
|
|
52
|
+
attach(path: string, options?: any): this;
|
|
53
|
+
attachData(data: any, filename: string, options?: any): this;
|
|
54
|
+
attachStream(stream: any, filename: string, options?: any): this;
|
|
16
55
|
from(address: string | {
|
|
17
56
|
name: string;
|
|
18
57
|
address: string;
|
|
19
58
|
}): this;
|
|
59
|
+
replyTo(address: string | {
|
|
60
|
+
name: string;
|
|
61
|
+
address: string;
|
|
62
|
+
}): this;
|
|
20
63
|
}
|
|
21
64
|
//# sourceMappingURL=Mailable.d.ts.map
|
package/dist/Mailable.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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;IACzD,cAAc,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,M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E,OAAO,GAAE,GAAQ;IAKtC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ;IAKzD,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ;IAK7D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAKxD,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAIrE"}
|
package/dist/Mailable.js
CHANGED
|
@@ -5,6 +5,36 @@ class Mailable {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this.viewData = {};
|
|
7
7
|
this.attachments = [];
|
|
8
|
+
this.toRecipients = [];
|
|
9
|
+
this.ccRecipients = [];
|
|
10
|
+
this.bccRecipients = [];
|
|
11
|
+
}
|
|
12
|
+
to(address) {
|
|
13
|
+
if (Array.isArray(address)) {
|
|
14
|
+
this.toRecipients = this.toRecipients.concat(address);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
this.toRecipients.push(address);
|
|
18
|
+
}
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
cc(address) {
|
|
22
|
+
if (Array.isArray(address)) {
|
|
23
|
+
this.ccRecipients = this.ccRecipients.concat(address);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.ccRecipients.push(address);
|
|
27
|
+
}
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
bcc(address) {
|
|
31
|
+
if (Array.isArray(address)) {
|
|
32
|
+
this.bccRecipients = this.bccRecipients.concat(address);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.bccRecipients.push(address);
|
|
36
|
+
}
|
|
37
|
+
return this;
|
|
8
38
|
}
|
|
9
39
|
subject(subject) {
|
|
10
40
|
this.subjectLine = subject;
|
|
@@ -19,14 +49,26 @@ class Mailable {
|
|
|
19
49
|
this.textContent = content;
|
|
20
50
|
return this;
|
|
21
51
|
}
|
|
22
|
-
attach(path) {
|
|
23
|
-
this.attachments.push({ path });
|
|
52
|
+
attach(path, options = {}) {
|
|
53
|
+
this.attachments.push({ path, ...options });
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
attachData(data, filename, options = {}) {
|
|
57
|
+
this.attachments.push({ content: data, filename, ...options });
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
attachStream(stream, filename, options = {}) {
|
|
61
|
+
this.attachments.push({ content: stream, filename, ...options });
|
|
24
62
|
return this;
|
|
25
63
|
}
|
|
26
64
|
from(address) {
|
|
27
65
|
this.fromAddress = address;
|
|
28
66
|
return this;
|
|
29
67
|
}
|
|
68
|
+
replyTo(address) {
|
|
69
|
+
this.replyToAddress = address;
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
30
72
|
}
|
|
31
73
|
exports.Mailable = Mailable;
|
|
32
74
|
//# sourceMappingURL=Mailable.js.map
|
package/dist/Mailable.js.map
CHANGED
|
@@ -1 +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;
|
|
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;QAIxB,iBAAY,GAAmD,EAAE,CAAC;QAClE,iBAAY,GAAmD,EAAE,CAAC;QAClE,kBAAa,GAAmD,EAAE,CAAC;IAuE9E,CAAC;IAnEU,EAAE,CAAC,OAAoG;QAC1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I,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,IAAY,EAAE,UAAe,EAAE;QACzC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,UAAU,CAAC,IAAS,EAAE,QAAgB,EAAE,UAAe,EAAE;QAC5D,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,YAAY,CAAC,MAAW,EAAE,QAAgB,EAAE,UAAe,EAAE;QAChE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,IAAI,CAAC,OAAmD;QAC3D,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,OAAO,CAAC,OAAmD;QAC9D,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlFD,4BAkFC"}
|
package/dist/Mailer.d.ts
CHANGED
|
@@ -8,12 +8,16 @@ export declare class Mailer {
|
|
|
8
8
|
protected name: string;
|
|
9
9
|
protected transport: Transport;
|
|
10
10
|
protected viewRenderer?: ViewRenderer | undefined;
|
|
11
|
-
|
|
11
|
+
protected manager?: any | undefined;
|
|
12
|
+
constructor(name: string, transport: Transport, viewRenderer?: ViewRenderer | undefined, manager?: any | undefined);
|
|
12
13
|
to(users: string | Address | (string | Address)[]): PendingMail;
|
|
14
|
+
cc(users: string | Address | (string | Address)[]): PendingMail;
|
|
15
|
+
bcc(users: string | Address | (string | Address)[]): PendingMail;
|
|
13
16
|
send(viewPath: string, data: any, callback: (message: Message) => void): Promise<void>;
|
|
14
17
|
sendMailable(mailable: Mailable): Promise<void>;
|
|
15
18
|
sendRaw(message: any): Promise<void>;
|
|
16
19
|
getRenderer(): ViewRenderer | undefined;
|
|
20
|
+
getQueue(): any;
|
|
17
21
|
}
|
|
18
22
|
export declare class PendingMail {
|
|
19
23
|
protected mailer: Mailer;
|
|
@@ -22,10 +26,18 @@ export declare class PendingMail {
|
|
|
22
26
|
protected viewData: any;
|
|
23
27
|
constructor(mailer: Mailer);
|
|
24
28
|
to(users: string | Address | (string | Address)[]): this;
|
|
29
|
+
cc(users: string | Address | (string | Address)[]): this;
|
|
30
|
+
bcc(users: string | Address | (string | Address)[]): this;
|
|
25
31
|
subject(subject: string): this;
|
|
32
|
+
replyTo(address: string | Address): this;
|
|
26
33
|
text(content: string): this;
|
|
27
34
|
view(path: string, data?: any): this;
|
|
28
|
-
attach(path: string): this;
|
|
35
|
+
attach(path: string, options?: any): this;
|
|
36
|
+
attachData(data: any, filename: string, options?: any): this;
|
|
37
|
+
attachStream(stream: any, filename: string, options?: any): this;
|
|
29
38
|
send(mailable?: Mailable): Promise<void>;
|
|
39
|
+
queue(mailable?: Mailable): Promise<any>;
|
|
40
|
+
later(delay: number | Date, mailable?: Mailable): Promise<any>;
|
|
41
|
+
protected prepareMessage(): any;
|
|
30
42
|
}
|
|
31
43
|
//# sourceMappingURL=Mailer.d.ts.map
|
package/dist/Mailer.d.ts.map
CHANGED
|
@@ -1 +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,EAA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Q;IA2BrD,SAAS,CAAC,cAAc,IAAI,GAAG;CAIlC"}
|
package/dist/Mailer.js
CHANGED
|
@@ -3,14 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PendingMail = exports.Mailer = void 0;
|
|
4
4
|
const Message_1 = require("./Message");
|
|
5
5
|
class Mailer {
|
|
6
|
-
constructor(name, transport, viewRenderer) {
|
|
6
|
+
constructor(name, transport, viewRenderer, manager) {
|
|
7
7
|
this.name = name;
|
|
8
8
|
this.transport = transport;
|
|
9
9
|
this.viewRenderer = viewRenderer;
|
|
10
|
+
this.manager = manager;
|
|
10
11
|
}
|
|
11
12
|
to(users) {
|
|
12
13
|
return new PendingMail(this).to(users);
|
|
13
14
|
}
|
|
15
|
+
cc(users) {
|
|
16
|
+
return new PendingMail(this).cc(users);
|
|
17
|
+
}
|
|
18
|
+
bcc(users) {
|
|
19
|
+
return new PendingMail(this).bcc(users);
|
|
20
|
+
}
|
|
14
21
|
async send(viewPath, data, callback) {
|
|
15
22
|
const message = new Message_1.Message();
|
|
16
23
|
callback(message);
|
|
@@ -29,6 +36,9 @@ class Mailer {
|
|
|
29
36
|
getRenderer() {
|
|
30
37
|
return this.viewRenderer;
|
|
31
38
|
}
|
|
39
|
+
getQueue() {
|
|
40
|
+
return this.manager?.getQueue();
|
|
41
|
+
}
|
|
32
42
|
}
|
|
33
43
|
exports.Mailer = Mailer;
|
|
34
44
|
class PendingMail {
|
|
@@ -41,10 +51,22 @@ class PendingMail {
|
|
|
41
51
|
this.message.to(users);
|
|
42
52
|
return this;
|
|
43
53
|
}
|
|
54
|
+
cc(users) {
|
|
55
|
+
this.message.cc(users);
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
bcc(users) {
|
|
59
|
+
this.message.bcc(users);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
44
62
|
subject(subject) {
|
|
45
63
|
this.message.subject(subject);
|
|
46
64
|
return this;
|
|
47
65
|
}
|
|
66
|
+
replyTo(address) {
|
|
67
|
+
this.message.replyTo(address);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
48
70
|
text(content) {
|
|
49
71
|
this.message.textContent(content);
|
|
50
72
|
return this;
|
|
@@ -54,17 +76,34 @@ class PendingMail {
|
|
|
54
76
|
this.viewData = data;
|
|
55
77
|
return this;
|
|
56
78
|
}
|
|
57
|
-
attach(path) {
|
|
58
|
-
this.message.attach({ path });
|
|
79
|
+
attach(path, options = {}) {
|
|
80
|
+
this.message.attach({ path, ...options });
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
attachData(data, filename, options = {}) {
|
|
84
|
+
this.message.attachData(data, filename, options);
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
attachStream(stream, filename, options = {}) {
|
|
88
|
+
this.message.attachStream(stream, filename, options);
|
|
59
89
|
return this;
|
|
60
90
|
}
|
|
61
91
|
async send(mailable) {
|
|
92
|
+
if (mailable && typeof mailable.build === 'function') {
|
|
93
|
+
try {
|
|
94
|
+
mailable.build();
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
// Ignore build errors if already built or not a builder
|
|
98
|
+
}
|
|
99
|
+
}
|
|
62
100
|
if (mailable) {
|
|
63
|
-
mailable.build();
|
|
64
101
|
if (mailable.subjectLine)
|
|
65
102
|
this.message.subject(mailable.subjectLine);
|
|
66
103
|
if (mailable.fromAddress)
|
|
67
104
|
this.message.from(mailable.fromAddress);
|
|
105
|
+
if (mailable.replyToAddress)
|
|
106
|
+
this.message.replyTo(mailable.replyToAddress);
|
|
68
107
|
if (mailable.textContent)
|
|
69
108
|
this.message.textContent(mailable.textContent);
|
|
70
109
|
if (mailable.viewPath) {
|
|
@@ -74,6 +113,12 @@ class PendingMail {
|
|
|
74
113
|
if (mailable.attachments) {
|
|
75
114
|
mailable.attachments.forEach(att => this.message.attach(att));
|
|
76
115
|
}
|
|
116
|
+
if (mailable.ccRecipients) {
|
|
117
|
+
this.message.cc(mailable.ccRecipients);
|
|
118
|
+
}
|
|
119
|
+
if (mailable.bccRecipients) {
|
|
120
|
+
this.message.bcc(mailable.bccRecipients);
|
|
121
|
+
}
|
|
77
122
|
}
|
|
78
123
|
if (this.viewPath) {
|
|
79
124
|
const renderer = this.mailer.getRenderer();
|
|
@@ -84,6 +129,58 @@ class PendingMail {
|
|
|
84
129
|
}
|
|
85
130
|
return this.mailer.sendRaw(this.message.getPayload());
|
|
86
131
|
}
|
|
132
|
+
async queue(mailable) {
|
|
133
|
+
const queue = this.mailer.getQueue();
|
|
134
|
+
if (!queue) {
|
|
135
|
+
throw new Error('Queue not configured. Please use Mail.setQueue() to enable queued emails.');
|
|
136
|
+
}
|
|
137
|
+
if (mailable && typeof mailable.build === 'function') {
|
|
138
|
+
try {
|
|
139
|
+
mailable.build();
|
|
140
|
+
}
|
|
141
|
+
catch (e) { }
|
|
142
|
+
}
|
|
143
|
+
if (mailable && mailable.constructor && mailable.constructor.name !== 'Object') {
|
|
144
|
+
const payload = this.message.getPayload();
|
|
145
|
+
if (payload.to && payload.to.length > 0) {
|
|
146
|
+
mailable.toRecipients = (mailable.toRecipients || []).concat(payload.to);
|
|
147
|
+
}
|
|
148
|
+
if (payload.cc && payload.cc.length > 0) {
|
|
149
|
+
mailable.ccRecipients = (mailable.ccRecipients || []).concat(payload.cc);
|
|
150
|
+
}
|
|
151
|
+
if (payload.bcc && payload.bcc.length > 0) {
|
|
152
|
+
mailable.bccRecipients = (mailable.bccRecipients || []).concat(payload.bcc);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const { SendQueuedMailable } = require('./Jobs/SendQueuedMailable');
|
|
156
|
+
return queue.dispatch(new SendQueuedMailable(mailable || this.prepareMessage(), this.mailer['name']));
|
|
157
|
+
}
|
|
158
|
+
async later(delay, mailable) {
|
|
159
|
+
const queue = this.mailer.getQueue();
|
|
160
|
+
if (!queue) {
|
|
161
|
+
throw new Error('Queue not configured. Please use Mail.setQueue() to enable queued emails.');
|
|
162
|
+
}
|
|
163
|
+
if (mailable && typeof mailable.build === 'function') {
|
|
164
|
+
try {
|
|
165
|
+
mailable.build();
|
|
166
|
+
}
|
|
167
|
+
catch (e) { }
|
|
168
|
+
}
|
|
169
|
+
if (mailable && mailable.constructor && mailable.constructor.name !== 'Object') {
|
|
170
|
+
const payload = this.message.getPayload();
|
|
171
|
+
if (payload.to && payload.to.length > 0) {
|
|
172
|
+
mailable.toRecipients = (mailable.toRecipients || []).concat(payload.to);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const { SendQueuedMailable } = require('./Jobs/SendQueuedMailable');
|
|
176
|
+
const job = new SendQueuedMailable(mailable || this.prepareMessage(), this.mailer['name']);
|
|
177
|
+
job.onDelay(delay);
|
|
178
|
+
return queue.dispatch(job);
|
|
179
|
+
}
|
|
180
|
+
prepareMessage() {
|
|
181
|
+
// Logic to finalize the message object before sending/queueing
|
|
182
|
+
return this.message.getPayload();
|
|
183
|
+
}
|
|
87
184
|
}
|
|
88
185
|
exports.PendingMail = PendingMail;
|
|
89
186
|
//# sourceMappingURL=Mailer.js.map
|
package/dist/Mailer.js.map
CHANGED
|
@@ -1 +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;
|
|
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,EAC3B,OAAa;QAHb,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAW;QACpB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,YAAO,GAAP,OAAO,CAAM;IACvB,CAAC;IAEL,EAAE,CAAC,KAA8C;QAC7C,OAAO,IAAI,WAAW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|
-
content?:
|
|
4
|
+
content?: any;
|
|
5
5
|
contentType?: string;
|
|
6
6
|
cid?: string;
|
|
7
7
|
encoding?: string;
|
|
@@ -30,6 +30,8 @@ export declare class Message {
|
|
|
30
30
|
textContent(content: string): this;
|
|
31
31
|
htmlContent(content: string): this;
|
|
32
32
|
attach(attachment: Attachment): this;
|
|
33
|
+
attachData(data: Buffer | string, filename: string, options?: Partial<Attachment>): this;
|
|
34
|
+
attachStream(stream: any, filename: string, options?: Partial<Attachment>): this;
|
|
33
35
|
getPayload(): {
|
|
34
36
|
to: (string | Address)[];
|
|
35
37
|
cc: (string | Address)[];
|
package/dist/Message.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../src/Message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../src/Message.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,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,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