@forinda/kickjs-mailer 1.2.12 → 1.2.13
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 +60 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @forinda/kickjs-mailer
|
|
2
|
+
|
|
3
|
+
Pluggable email sending for KickJS — SMTP, Resend, SES, and custom providers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Using the KickJS CLI (recommended — auto-installs peer dependencies)
|
|
9
|
+
kick add mailer
|
|
10
|
+
|
|
11
|
+
# Manual install
|
|
12
|
+
pnpm add @forinda/kickjs-mailer nodemailer
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- `MailerAdapter` — lifecycle adapter that registers the mailer in DI
|
|
18
|
+
- `MailerService` — injectable service for sending email
|
|
19
|
+
- Built-in providers: `SmtpProvider` (nodemailer), `ConsoleProvider` (dev logging)
|
|
20
|
+
- `MAILER` token for DI injection
|
|
21
|
+
- Pluggable `MailProvider` interface for custom transports (Resend, SES, etc.)
|
|
22
|
+
|
|
23
|
+
## Quick Example
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { MailerAdapter, SmtpProvider, ConsoleProvider } from '@forinda/kickjs-mailer'
|
|
27
|
+
|
|
28
|
+
bootstrap({
|
|
29
|
+
modules,
|
|
30
|
+
adapters: [
|
|
31
|
+
new MailerAdapter({
|
|
32
|
+
provider: process.env.NODE_ENV === 'production'
|
|
33
|
+
? new SmtpProvider({ host: 'smtp.example.com', port: 587, auth: { user: '...', pass: '...' } })
|
|
34
|
+
: new ConsoleProvider(),
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// In a service
|
|
40
|
+
@Service()
|
|
41
|
+
class NotifyService {
|
|
42
|
+
@Inject(MAILER) private mailer!: MailerService
|
|
43
|
+
|
|
44
|
+
async sendWelcome(email: string) {
|
|
45
|
+
await this.mailer.send({
|
|
46
|
+
to: email,
|
|
47
|
+
subject: 'Welcome!',
|
|
48
|
+
html: '<h1>Welcome to our app</h1>',
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
[Full documentation](https://forinda.github.io/kick-js/guide/mailer)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-mailer",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.13",
|
|
4
4
|
"description": "Pluggable email sending for KickJS — nodemailer, Resend, SES, and custom providers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"reflect-metadata": "^0.2.2",
|
|
31
|
-
"@forinda/kickjs-core": "1.2.
|
|
31
|
+
"@forinda/kickjs-core": "1.2.13"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"nodemailer": ">=7.0.11"
|