@impruthvi/nodemail 0.2.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/CHANGELOG.md +81 -0
- package/LICENSE +21 -0
- package/README.md +323 -0
- package/dist/core/MailFacade.d.ts +13 -0
- package/dist/core/MailFacade.d.ts.map +1 -0
- package/dist/core/MailFacade.js +30 -0
- package/dist/core/MailFacade.js.map +1 -0
- package/dist/core/MailManager.d.ts +23 -0
- package/dist/core/MailManager.d.ts.map +1 -0
- package/dist/core/MailManager.js +91 -0
- package/dist/core/MailManager.js.map +1 -0
- package/dist/core/Mailable.d.ts +12 -0
- package/dist/core/Mailable.d.ts.map +1 -0
- package/dist/core/Mailable.js +38 -0
- package/dist/core/Mailable.js.map +1 -0
- package/dist/core/Message.d.ts +17 -0
- package/dist/core/Message.d.ts.map +1 -0
- package/dist/core/Message.js +62 -0
- package/dist/core/Message.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/SendGridProvider.d.ts +7 -0
- package/dist/providers/SendGridProvider.d.ts.map +1 -0
- package/dist/providers/SendGridProvider.js +72 -0
- package/dist/providers/SendGridProvider.js.map +1 -0
- package/dist/providers/SesProvider.d.ts +7 -0
- package/dist/providers/SesProvider.d.ts.map +1 -0
- package/dist/providers/SesProvider.js +97 -0
- package/dist/providers/SesProvider.js.map +1 -0
- package/dist/providers/SmtpProvider.d.ts +8 -0
- package/dist/providers/SmtpProvider.d.ts.map +1 -0
- package/dist/providers/SmtpProvider.js +81 -0
- package/dist/providers/SmtpProvider.js.map +1 -0
- package/dist/types/index.d.ts +92 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/examples/aws-ses.ts +46 -0
- package/examples/basic-smtp.ts +50 -0
- package/examples/sendgrid.ts +44 -0
- package/package.json +117 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2025-11-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Complete test suite** with 95%+ coverage (25 tests)
|
|
14
|
+
- Unit tests for SmtpProvider (12 tests)
|
|
15
|
+
- Unit tests for MailManager (13 tests)
|
|
16
|
+
- MessageBuilder fluent API tests
|
|
17
|
+
- Jest configuration excluding optional dependencies from coverage
|
|
18
|
+
- Tests for provider factory pattern and caching
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Updated README with current feature status
|
|
22
|
+
- PROGRESS.md now reflects Phase 2 completion
|
|
23
|
+
|
|
24
|
+
## [0.1.0] - 2025-11-23
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **Core email functionality**
|
|
28
|
+
- Mail facade with fluent API (`Mail.to().subject().send()`)
|
|
29
|
+
- MailManager with provider factory pattern
|
|
30
|
+
- MessageBuilder with chainable methods
|
|
31
|
+
|
|
32
|
+
- **Email providers** (3 total)
|
|
33
|
+
- SMTP provider via nodemailer ✅ Tested
|
|
34
|
+
- SendGrid provider via @sendgrid/mail
|
|
35
|
+
- AWS SES provider via @aws-sdk/client-ses
|
|
36
|
+
|
|
37
|
+
- **Features**
|
|
38
|
+
- Multiple recipients (to, cc, bcc)
|
|
39
|
+
- HTML and text content
|
|
40
|
+
- Email attachments (SMTP, SendGrid)
|
|
41
|
+
- Address formatting with names
|
|
42
|
+
- Reply-to support
|
|
43
|
+
- Custom headers
|
|
44
|
+
- Error handling with graceful degradation
|
|
45
|
+
|
|
46
|
+
- **Type safety**
|
|
47
|
+
- Full TypeScript support
|
|
48
|
+
- Strict mode enabled
|
|
49
|
+
- Complete type definitions
|
|
50
|
+
|
|
51
|
+
- **Architecture**
|
|
52
|
+
- Lightweight core (~25MB with SMTP only)
|
|
53
|
+
- Optional providers as peerDependencies
|
|
54
|
+
- Provider caching for performance
|
|
55
|
+
- Dynamic provider loading
|
|
56
|
+
|
|
57
|
+
- **Documentation**
|
|
58
|
+
- README with examples for all providers
|
|
59
|
+
- Examples folder with working demos
|
|
60
|
+
- Installation guide for each provider
|
|
61
|
+
- CONTRIBUTING.md
|
|
62
|
+
|
|
63
|
+
- **Development**
|
|
64
|
+
- ESLint 9 with flat config
|
|
65
|
+
- Prettier formatting
|
|
66
|
+
- TypeScript 5.6.3
|
|
67
|
+
- Jest testing framework
|
|
68
|
+
- Build and lint scripts
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
- TypeScript strict mode compliance
|
|
72
|
+
- ESLint warnings in provider implementations
|
|
73
|
+
- Address formatting for MailAddress objects
|
|
74
|
+
|
|
75
|
+
## [0.0.1] - 2025-11-23
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
- Initial project setup
|
|
79
|
+
- Package structure
|
|
80
|
+
- Git repository initialization
|
|
81
|
+
- MIT License
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Pruthvisinh Rajput (https://github.com/impruthvi)
|
|
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,323 @@
|
|
|
1
|
+
# nodemail
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
|
|
6
|
+
> 🚧 **Work in Progress** - A unified mail service for Node.js/TypeScript inspired by Laravel's elegant Mail system.
|
|
7
|
+
|
|
8
|
+
**nodemail** aims to bring the simplicity and elegance of Laravel's Mail system to the Node.js ecosystem with full TypeScript support.
|
|
9
|
+
|
|
10
|
+
## 🎯 Vision
|
|
11
|
+
|
|
12
|
+
A lightweight, developer-friendly email library where you can:
|
|
13
|
+
- Switch email providers by just changing environment variables
|
|
14
|
+
- Use elegant, class-based Mailable patterns
|
|
15
|
+
- Keep your package lightweight (install only what you need)
|
|
16
|
+
- Write clean, maintainable email code
|
|
17
|
+
|
|
18
|
+
Inspired by [Laravel's Mail system](https://laravel.com/docs/mail).
|
|
19
|
+
|
|
20
|
+
## ✨ Features
|
|
21
|
+
|
|
22
|
+
### ✅ Available Now
|
|
23
|
+
- 🎯 **Multiple Providers** - SMTP (Nodemailer), SendGrid, AWS SES
|
|
24
|
+
- 🪶 **Lightweight** - Only ~25MB with SMTP, install additional providers as needed
|
|
25
|
+
- 🔒 **Type-Safe** - Full TypeScript support with strict typing
|
|
26
|
+
- 🎨 **Fluent API** - Chainable, Laravel-inspired interface
|
|
27
|
+
- ⚡ **Dynamic Loading** - Providers loaded only when installed (peerDependencies)
|
|
28
|
+
- 🛡️ **Error Handling** - Graceful degradation with helpful error messages
|
|
29
|
+
|
|
30
|
+
### 🚧 Coming Soon
|
|
31
|
+
- 📝 **Mailable Classes** - Enhanced reusable email definitions
|
|
32
|
+
- 🔔 **Notifications** - Multi-channel notification system
|
|
33
|
+
- 📋 **Markdown Mail** - Beautiful emails from markdown
|
|
34
|
+
- 🧪 **Testing Utilities** - Mail::fake() for testing
|
|
35
|
+
- 📦 **Queue Support** - Background email sending (Bull/BullMQ)
|
|
36
|
+
- 🎨 **Template Engines** - Handlebars, EJS, Pug
|
|
37
|
+
- 🌍 **i18n Support** - Multi-language emails
|
|
38
|
+
- 🚀 **More Providers** - Mailgun, Resend, Postmark, Mailtrap
|
|
39
|
+
|
|
40
|
+
## 📦 Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install nodemail
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Lightweight by default!** Only includes SMTP support (~25MB).
|
|
47
|
+
|
|
48
|
+
### Adding Providers (Optional)
|
|
49
|
+
|
|
50
|
+
**Currently Supported:**
|
|
51
|
+
```bash
|
|
52
|
+
# SendGrid (✅ Implemented)
|
|
53
|
+
npm install @sendgrid/mail
|
|
54
|
+
|
|
55
|
+
# AWS SES (✅ Implemented)
|
|
56
|
+
npm install @aws-sdk/client-ses
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Coming Soon:**
|
|
60
|
+
```bash
|
|
61
|
+
# Mailgun
|
|
62
|
+
npm install mailgun.js
|
|
63
|
+
|
|
64
|
+
# Resend
|
|
65
|
+
npm install resend
|
|
66
|
+
|
|
67
|
+
# Postmark
|
|
68
|
+
npm install postmark
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 🚀 Quick Start
|
|
72
|
+
|
|
73
|
+
### SMTP (Nodemailer)
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { Mail } from 'nodemail';
|
|
77
|
+
|
|
78
|
+
Mail.configure({
|
|
79
|
+
default: 'smtp',
|
|
80
|
+
from: {
|
|
81
|
+
address: 'noreply@example.com',
|
|
82
|
+
name: 'My App',
|
|
83
|
+
},
|
|
84
|
+
mailers: {
|
|
85
|
+
smtp: {
|
|
86
|
+
driver: 'smtp',
|
|
87
|
+
host: process.env.SMTP_HOST,
|
|
88
|
+
port: 587,
|
|
89
|
+
auth: {
|
|
90
|
+
user: process.env.SMTP_USER,
|
|
91
|
+
pass: process.env.SMTP_PASS,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Send emails
|
|
98
|
+
await Mail.to('user@example.com')
|
|
99
|
+
.subject('Welcome!')
|
|
100
|
+
.html('<h1>Hello World!</h1>')
|
|
101
|
+
.send();
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### SendGrid
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// npm install @sendgrid/mail
|
|
108
|
+
Mail.configure({
|
|
109
|
+
default: 'sendgrid',
|
|
110
|
+
from: { address: 'noreply@example.com', name: 'My App' },
|
|
111
|
+
mailers: {
|
|
112
|
+
sendgrid: {
|
|
113
|
+
driver: 'sendgrid',
|
|
114
|
+
apiKey: process.env.SENDGRID_API_KEY,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### AWS SES
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
// npm install @aws-sdk/client-ses
|
|
124
|
+
Mail.configure({
|
|
125
|
+
default: 'ses',
|
|
126
|
+
from: { address: 'noreply@example.com', name: 'My App' },
|
|
127
|
+
mailers: {
|
|
128
|
+
ses: {
|
|
129
|
+
driver: 'ses',
|
|
130
|
+
region: 'us-east-1',
|
|
131
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
132
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Advanced usage (coming soon):**
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { Mail } from 'nodemail';
|
|
142
|
+
|
|
143
|
+
// Configure once
|
|
144
|
+
Mail.configure({
|
|
145
|
+
default: 'smtp',
|
|
146
|
+
from: {
|
|
147
|
+
address: 'noreply@example.com',
|
|
148
|
+
name: 'My App',
|
|
149
|
+
},
|
|
150
|
+
mailers: {
|
|
151
|
+
smtp: {
|
|
152
|
+
driver: 'smtp',
|
|
153
|
+
host: process.env.MAIL_HOST,
|
|
154
|
+
port: 587,
|
|
155
|
+
username: process.env.MAIL_USERNAME,
|
|
156
|
+
password: process.env.MAIL_PASSWORD,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Send emails
|
|
162
|
+
await Mail.to('user@example.com')
|
|
163
|
+
.subject('Welcome!')
|
|
164
|
+
.html('<h1>Hello World!</h1>')
|
|
165
|
+
.send();
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Advanced usage (coming soon):**
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { Mail } from 'nodemail';
|
|
172
|
+
|
|
173
|
+
// Configure once
|
|
174
|
+
Mail.configure({
|
|
175
|
+
default: 'smtp',
|
|
176
|
+
from: {
|
|
177
|
+
address: 'noreply@example.com',
|
|
178
|
+
name: 'My App',
|
|
179
|
+
},
|
|
180
|
+
mailers: {
|
|
181
|
+
smtp: {
|
|
182
|
+
driver: 'smtp',
|
|
183
|
+
host: process.env.MAIL_HOST,
|
|
184
|
+
port: 587,
|
|
185
|
+
username: process.env.MAIL_USERNAME,
|
|
186
|
+
password: process.env.MAIL_PASSWORD,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Send anywhere in your app
|
|
192
|
+
await Mail.to('user@example.com')
|
|
193
|
+
.subject('Welcome!')
|
|
194
|
+
.html('<h1>Hello World!</h1>')
|
|
195
|
+
.send();
|
|
196
|
+
|
|
197
|
+
// Or use Mailable classes
|
|
198
|
+
class WelcomeEmail extends Mailable {
|
|
199
|
+
constructor(private user: User) {
|
|
200
|
+
super();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
build() {
|
|
204
|
+
return this
|
|
205
|
+
.subject(`Welcome, ${this.user.name}!`)
|
|
206
|
+
.view('emails.welcome', { user: this.user });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
await Mail.to('user@example.com').send(new WelcomeEmail(user));
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 🛠️ Current Status
|
|
214
|
+
|
|
215
|
+
**Phase 1: Project Setup** ✅ Complete
|
|
216
|
+
- TypeScript 5.6 configuration
|
|
217
|
+
- ESLint 9 (flat config)
|
|
218
|
+
- Modern tooling setup
|
|
219
|
+
- Package structure
|
|
220
|
+
- Core type definitions
|
|
221
|
+
- Lightweight architecture (peerDependencies)
|
|
222
|
+
|
|
223
|
+
**Phase 2: Core Implementation** ✅ Complete
|
|
224
|
+
- ✅ Mail Manager & Facade
|
|
225
|
+
- ✅ SMTP Provider (nodemailer)
|
|
226
|
+
- ✅ SendGrid Provider (@sendgrid/mail)
|
|
227
|
+
- ✅ AWS SES Provider (@aws-sdk/client-ses)
|
|
228
|
+
- ✅ Message builder with fluent API
|
|
229
|
+
- ✅ Configuration system
|
|
230
|
+
- ✅ Error handling & graceful degradation
|
|
231
|
+
- 🚧 Other providers (Mailgun, Resend, Postmark) - coming soon
|
|
232
|
+
|
|
233
|
+
**Phase 3: Advanced Features** 🚧 Next
|
|
234
|
+
- Enhanced Mailable classes with template support
|
|
235
|
+
- Additional providers (Mailgun, Resend, Postmark)
|
|
236
|
+
- Queue integration (Bull/BullMQ)
|
|
237
|
+
- Template engines (Handlebars, EJS, Pug)
|
|
238
|
+
- Testing utilities (Mail::fake(), assertSent())
|
|
239
|
+
- Unit test coverage
|
|
240
|
+
- CLI tools
|
|
241
|
+
- Markdown mail support
|
|
242
|
+
|
|
243
|
+
## 🤝 Contributing
|
|
244
|
+
|
|
245
|
+
This project is in early development. Contributions, ideas, and feedback are welcome!
|
|
246
|
+
|
|
247
|
+
1. Fork the repository
|
|
248
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
249
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
250
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
251
|
+
5. Open a Pull Request
|
|
252
|
+
|
|
253
|
+
### Development Setup
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Clone the repository
|
|
257
|
+
git clone https://github.com/impruthvi/nodemail.git
|
|
258
|
+
cd nodemail
|
|
259
|
+
|
|
260
|
+
# Install dependencies
|
|
261
|
+
npm install
|
|
262
|
+
|
|
263
|
+
# Build
|
|
264
|
+
npm run build
|
|
265
|
+
|
|
266
|
+
# Lint
|
|
267
|
+
npm run lint
|
|
268
|
+
|
|
269
|
+
# Format code
|
|
270
|
+
npm run format
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 💡 Why nodemail?
|
|
274
|
+
|
|
275
|
+
### Inspired by Laravel, Built for Node.js
|
|
276
|
+
|
|
277
|
+
If you've used Laravel's Mail system, you know how elegant it is:
|
|
278
|
+
|
|
279
|
+
```php
|
|
280
|
+
// Laravel (PHP)
|
|
281
|
+
Mail::to($user->email)->send(new WelcomeEmail($user));
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**nodemail** brings this same elegance to Node.js/TypeScript:
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
// nodemail (TypeScript)
|
|
288
|
+
await Mail.to(user.email).send(new WelcomeEmail(user));
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Lightweight by Design
|
|
292
|
+
|
|
293
|
+
Unlike other packages that bundle everything:
|
|
294
|
+
- **Base package**: ~25MB (SMTP only)
|
|
295
|
+
- **Add providers as needed**: `npm install @sendgrid/mail`
|
|
296
|
+
- **No bloat**: Only install what you use
|
|
297
|
+
|
|
298
|
+
## 📊 Package Philosophy
|
|
299
|
+
|
|
300
|
+
- **Modular**: Install only the providers you need
|
|
301
|
+
- **Type-Safe**: Full TypeScript support with strict typing
|
|
302
|
+
- **Developer-Friendly**: Clean, intuitive API
|
|
303
|
+
- **Production-Ready**: Built with best practices
|
|
304
|
+
- **Well-Tested**: Comprehensive test coverage (coming soon)
|
|
305
|
+
|
|
306
|
+
## 📄 License
|
|
307
|
+
|
|
308
|
+
MIT © [Pruthvi](https://github.com/impruthvi)
|
|
309
|
+
|
|
310
|
+
## 🙏 Acknowledgments
|
|
311
|
+
|
|
312
|
+
Inspired by [Laravel's Mail system](https://laravel.com/docs/mail) - bringing elegant email handling to Node.js.
|
|
313
|
+
|
|
314
|
+
## 📞 Support & Community
|
|
315
|
+
|
|
316
|
+
- 📫 [GitHub Issues](https://github.com/impruthvi/nodemail/issues) - Bug reports and feature requests
|
|
317
|
+
- 💬 [GitHub Discussions](https://github.com/impruthvi/nodemail/discussions) - Questions and community chat
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
**⭐ If you like this idea, please star the repo!** It helps gauge interest and motivates development.
|
|
322
|
+
|
|
323
|
+
**🚀 Want to contribute?** Check out the issues labeled `good first issue` or `help wanted`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MailManager } from './MailManager';
|
|
2
|
+
import type { MailConfig } from '../types';
|
|
3
|
+
declare class MailFacade {
|
|
4
|
+
private static instance;
|
|
5
|
+
static configure(config: MailConfig): void;
|
|
6
|
+
private static getInstance;
|
|
7
|
+
static to(address: string | string[]): import("./MailManager").MessageBuilder;
|
|
8
|
+
static mailer(name: string): MailManager;
|
|
9
|
+
static fake(): void;
|
|
10
|
+
static assertSent(): void;
|
|
11
|
+
}
|
|
12
|
+
export { MailFacade as Mail };
|
|
13
|
+
//# sourceMappingURL=MailFacade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailFacade.d.ts","sourceRoot":"","sources":["../../src/core/MailFacade.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,cAAM,UAAU;IACd,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA4B;IAKnD,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAO1C,OAAO,CAAC,MAAM,CAAC,WAAW;IAU1B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAOpC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM;IAO1B,MAAM,CAAC,IAAI,IAAI,IAAI;IAQnB,MAAM,CAAC,UAAU,IAAI,IAAI;CAI1B;AAED,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mail = void 0;
|
|
4
|
+
const MailManager_1 = require("./MailManager");
|
|
5
|
+
class MailFacade {
|
|
6
|
+
static instance = null;
|
|
7
|
+
static configure(config) {
|
|
8
|
+
this.instance = new MailManager_1.MailManager(config);
|
|
9
|
+
}
|
|
10
|
+
static getInstance() {
|
|
11
|
+
if (!this.instance) {
|
|
12
|
+
throw new Error('Mail not configured. Call Mail.configure() before using Mail facade.');
|
|
13
|
+
}
|
|
14
|
+
return this.instance;
|
|
15
|
+
}
|
|
16
|
+
static to(address) {
|
|
17
|
+
return this.getInstance().to(address);
|
|
18
|
+
}
|
|
19
|
+
static mailer(name) {
|
|
20
|
+
return this.getInstance().mailer(name);
|
|
21
|
+
}
|
|
22
|
+
static fake() {
|
|
23
|
+
throw new Error('Mail.fake() not yet implemented');
|
|
24
|
+
}
|
|
25
|
+
static assertSent() {
|
|
26
|
+
throw new Error('Mail.assertSent() not yet implemented');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Mail = MailFacade;
|
|
30
|
+
//# sourceMappingURL=MailFacade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailFacade.js","sourceRoot":"","sources":["../../src/core/MailFacade.ts"],"names":[],"mappings":";;;AAKA,+CAA4C;AAG5C,MAAM,UAAU;IACN,MAAM,CAAC,QAAQ,GAAuB,IAAI,CAAC;IAKnD,MAAM,CAAC,SAAS,CAAC,MAAkB;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAKO,MAAM,CAAC,WAAW;QACxB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAC1F,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAKD,MAAM,CAAC,EAAE,CAAC,OAA0B;QAClC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAKD,MAAM,CAAC,MAAM,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAKD,MAAM,CAAC,IAAI;QAET,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAKD,MAAM,CAAC,UAAU;QAEf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;;AAGoB,0BAAI"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MailConfig, MailOptions, MailResponse } from '../types';
|
|
2
|
+
export declare class MailManager {
|
|
3
|
+
private config;
|
|
4
|
+
private providers;
|
|
5
|
+
constructor(config: MailConfig);
|
|
6
|
+
private createProvider;
|
|
7
|
+
private getProvider;
|
|
8
|
+
to(address: string | string[]): MessageBuilder;
|
|
9
|
+
mailer(name: string): MailManager;
|
|
10
|
+
send(options: MailOptions): Promise<MailResponse>;
|
|
11
|
+
getDefaultMailer(): string;
|
|
12
|
+
}
|
|
13
|
+
export declare class MessageBuilder {
|
|
14
|
+
private manager;
|
|
15
|
+
options: Partial<MailOptions>;
|
|
16
|
+
constructor(manager: MailManager, to: string | string[]);
|
|
17
|
+
subject(subject: string): this;
|
|
18
|
+
html(html: string): this;
|
|
19
|
+
text(text: string): this;
|
|
20
|
+
from(from: string): this;
|
|
21
|
+
send(): Promise<MailResponse>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=MailManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailManager.d.ts","sourceRoot":"","sources":["../../src/core/MailManager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAEX,YAAY,EAEb,MAAM,UAAU,CAAC;AAKlB,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAAwC;gBAE7C,MAAM,EAAE,UAAU;IAO9B,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,WAAW;IAyBnB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAO7B,MAAM,CAAC,IAAI,EAAE,MAAM;IAab,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAQvD,gBAAgB,IAAI,MAAM;CAG3B;AAKD,qBAAa,cAAc;IAIvB,OAAO,CAAC,OAAO;IAHV,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAM;gBAGhC,OAAO,EAAE,WAAW,EAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE;IAKvB,OAAO,CAAC,OAAO,EAAE,MAAM;IAKvB,IAAI,CAAC,IAAI,EAAE,MAAM;IAKjB,IAAI,CAAC,IAAI,EAAE,MAAM;IAKjB,IAAI,CAAC,IAAI,EAAE,MAAM;IAKX,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC;CAOpC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageBuilder = exports.MailManager = void 0;
|
|
4
|
+
const SmtpProvider_1 = require("../providers/SmtpProvider");
|
|
5
|
+
const SendGridProvider_1 = require("../providers/SendGridProvider");
|
|
6
|
+
const SesProvider_1 = require("../providers/SesProvider");
|
|
7
|
+
class MailManager {
|
|
8
|
+
config;
|
|
9
|
+
providers = new Map();
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
createProvider(mailerConfig) {
|
|
14
|
+
switch (mailerConfig.driver) {
|
|
15
|
+
case 'smtp':
|
|
16
|
+
return new SmtpProvider_1.SmtpProvider(mailerConfig);
|
|
17
|
+
case 'sendgrid':
|
|
18
|
+
return new SendGridProvider_1.SendGridProvider(mailerConfig);
|
|
19
|
+
case 'ses':
|
|
20
|
+
return new SesProvider_1.SesProvider(mailerConfig);
|
|
21
|
+
default:
|
|
22
|
+
throw new Error(`Unsupported mail driver: ${mailerConfig.driver}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
getProvider(name) {
|
|
26
|
+
const mailerName = name ?? this.config.default;
|
|
27
|
+
if (!this.config.mailers[mailerName]) {
|
|
28
|
+
throw new Error(`Mailer '${mailerName}' is not configured`);
|
|
29
|
+
}
|
|
30
|
+
let provider = this.providers.get(mailerName);
|
|
31
|
+
if (!provider) {
|
|
32
|
+
const mailerConfig = this.config.mailers[mailerName];
|
|
33
|
+
if (!mailerConfig) {
|
|
34
|
+
throw new Error(`Mailer '${mailerName}' configuration not found`);
|
|
35
|
+
}
|
|
36
|
+
provider = this.createProvider(mailerConfig);
|
|
37
|
+
this.providers.set(mailerName, provider);
|
|
38
|
+
}
|
|
39
|
+
return provider;
|
|
40
|
+
}
|
|
41
|
+
to(address) {
|
|
42
|
+
return new MessageBuilder(this, address);
|
|
43
|
+
}
|
|
44
|
+
mailer(name) {
|
|
45
|
+
if (!this.config.mailers[name]) {
|
|
46
|
+
throw new Error(`Mailer '${name}' is not configured`);
|
|
47
|
+
}
|
|
48
|
+
const newConfig = { ...this.config, default: name };
|
|
49
|
+
return new MailManager(newConfig);
|
|
50
|
+
}
|
|
51
|
+
async send(options) {
|
|
52
|
+
const provider = this.getProvider();
|
|
53
|
+
return provider.send(options);
|
|
54
|
+
}
|
|
55
|
+
getDefaultMailer() {
|
|
56
|
+
return this.config.default;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.MailManager = MailManager;
|
|
60
|
+
class MessageBuilder {
|
|
61
|
+
manager;
|
|
62
|
+
options = {};
|
|
63
|
+
constructor(manager, to) {
|
|
64
|
+
this.manager = manager;
|
|
65
|
+
this.options.to = to;
|
|
66
|
+
}
|
|
67
|
+
subject(subject) {
|
|
68
|
+
this.options.subject = subject;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
html(html) {
|
|
72
|
+
this.options.html = html;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
text(text) {
|
|
76
|
+
this.options.text = text;
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
from(from) {
|
|
80
|
+
this.options.from = from;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
async send() {
|
|
84
|
+
if (!this.options.subject) {
|
|
85
|
+
throw new Error('Email subject is required');
|
|
86
|
+
}
|
|
87
|
+
return this.manager.send(this.options);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.MessageBuilder = MessageBuilder;
|
|
91
|
+
//# sourceMappingURL=MailManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MailManager.js","sourceRoot":"","sources":["../../src/core/MailManager.ts"],"names":[],"mappings":";;;AAYA,4DAAyD;AACzD,oEAAiE;AACjE,0DAAuD;AAEvD,MAAa,WAAW;IACd,MAAM,CAAa;IACnB,SAAS,GAA8B,IAAI,GAAG,EAAE,CAAC;IAEzD,YAAY,MAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAKO,cAAc,CAAC,YAA0B;QAC/C,QAAQ,YAAY,CAAC,MAAM,EAAE,CAAC;YAC5B,KAAK,MAAM;gBACT,OAAO,IAAI,2BAAY,CAAC,YAA6C,CAAC,CAAC;YACzE,KAAK,UAAU;gBACb,OAAO,IAAI,mCAAgB,CAAC,YAAiD,CAAC,CAAC;YACjF,KAAK,KAAK;gBACR,OAAO,IAAI,yBAAW,CAAC,YAA4C,CAAC,CAAC;YACvE;gBACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAKO,WAAW,CAAC,IAAa;QAC/B,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,qBAAqB,CAAC,CAAC;QAC9D,CAAC;QAGD,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,EAAE,CAAC;YAEd,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACrD,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,2BAA2B,CAAC,CAAC;YACpE,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;YAC7C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAKD,EAAE,CAAC,OAA0B;QAC3B,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAKD,MAAM,CAAC,IAAY;QACjB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,qBAAqB,CAAC,CAAC;QACxD,CAAC;QAGD,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACpD,OAAO,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAKD,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAKD,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;CACF;AAnFD,kCAmFC;AAKD,MAAa,cAAc;IAIf;IAHH,OAAO,GAAyB,EAAE,CAAC;IAE1C,YACU,OAAoB,EAC5B,EAAqB;QADb,YAAO,GAAP,OAAO,CAAa;QAG5B,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,CAAC,OAAe;QACrB,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAsB,CAAC,CAAC;IACxD,CAAC;CACF;AArCD,wCAqCC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MailOptions } from '../types';
|
|
2
|
+
export declare abstract class Mailable {
|
|
3
|
+
protected options: Partial<MailOptions>;
|
|
4
|
+
abstract build(): this;
|
|
5
|
+
protected subject(subject: string): this;
|
|
6
|
+
protected html(html: string): this;
|
|
7
|
+
protected text(text: string): this;
|
|
8
|
+
protected view(template: string, data?: Record<string, unknown>): this;
|
|
9
|
+
protected attach(path: string): this;
|
|
10
|
+
getMailOptions(): Partial<MailOptions>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Mailable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mailable.d.ts","sourceRoot":"","sources":["../../src/core/Mailable.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,8BAAsB,QAAQ;IAC5B,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAM;IAM7C,QAAQ,CAAC,KAAK,IAAI,IAAI;IAKtB,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQxC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQlC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQlC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAWtE,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAWpC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;CAIvC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mailable = void 0;
|
|
4
|
+
class Mailable {
|
|
5
|
+
options = {};
|
|
6
|
+
subject(subject) {
|
|
7
|
+
this.options.subject = subject;
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
html(html) {
|
|
11
|
+
this.options.html = html;
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
text(text) {
|
|
15
|
+
this.options.text = text;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
view(template, data) {
|
|
19
|
+
this.options.template = template;
|
|
20
|
+
if (data !== undefined) {
|
|
21
|
+
this.options.data = data;
|
|
22
|
+
}
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
attach(path) {
|
|
26
|
+
if (!this.options.attachments) {
|
|
27
|
+
this.options.attachments = [];
|
|
28
|
+
}
|
|
29
|
+
this.options.attachments.push({ filename: path, path });
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
getMailOptions() {
|
|
33
|
+
this.build();
|
|
34
|
+
return this.options;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Mailable = Mailable;
|
|
38
|
+
//# sourceMappingURL=Mailable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mailable.js","sourceRoot":"","sources":["../../src/core/Mailable.ts"],"names":[],"mappings":";;;AAMA,MAAsB,QAAQ;IAClB,OAAO,GAAyB,EAAE,CAAC;IAWnC,OAAO,CAAC,OAAe;QAC/B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAKS,IAAI,CAAC,IAAY;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAKS,IAAI,CAAC,IAAY;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAKS,IAAI,CAAC,QAAgB,EAAE,IAA8B;QAC7D,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACjC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAKS,MAAM,CAAC,IAAY;QAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAKD,cAAc;QACZ,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AA9DD,4BA8DC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MailOptions, MailAddress, Attachment } from '../types';
|
|
2
|
+
export declare class Message {
|
|
3
|
+
private options;
|
|
4
|
+
to(address: string | string[] | MailAddress | MailAddress[]): this;
|
|
5
|
+
from(address: string | MailAddress): this;
|
|
6
|
+
subject(subject: string): this;
|
|
7
|
+
html(html: string): this;
|
|
8
|
+
text(text: string): this;
|
|
9
|
+
cc(address: string | string[] | MailAddress | MailAddress[]): this;
|
|
10
|
+
bcc(address: string | string[] | MailAddress | MailAddress[]): this;
|
|
11
|
+
replyTo(address: string | MailAddress): this;
|
|
12
|
+
attach(attachment: Attachment): this;
|
|
13
|
+
header(name: string, value: string): this;
|
|
14
|
+
template(name: string, data: Record<string, unknown>): this;
|
|
15
|
+
toOptions(): Partial<MailOptions>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=Message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../src/core/Message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAErE,qBAAa,OAAO;IAClB,OAAO,CAAC,OAAO,CAA4B;IAK3C,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI;IAQlE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAQzC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ9B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQxB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI;IAQlE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI;IAQnE,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAQ5C,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAWpC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAWzC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAS3D,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;CAGlC"}
|