@zola_do/email 0.1.9 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +76 -0
  2. package/package.json +5 -2
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # @zola_do/email
2
+
3
+ Email service for NestJS applications with SMTP and Handlebars template support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Install individually
9
+ npm install @zola_do/email
10
+
11
+ # Or via meta package
12
+ npm install @zola_do/nestjs-shared
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Module Setup
18
+
19
+ ```typescript
20
+ import { Module } from '@nestjs/common';
21
+ import { EmailModule } from '@zola_do/email';
22
+
23
+ @Module({
24
+ imports: [EmailModule],
25
+ })
26
+ export class AppModule {}
27
+ ```
28
+
29
+ ### Sending Emails
30
+
31
+ Inject `EmailService` and send emails:
32
+
33
+ ```typescript
34
+ import { Injectable } from '@nestjs/common';
35
+ import { EmailService } from '@zola_do/email';
36
+
37
+ @Injectable()
38
+ export class NotificationService {
39
+ constructor(private readonly emailService: EmailService) {}
40
+
41
+ async sendWelcomeEmail(userEmail: string, userName: string) {
42
+ const body = `<h1>Welcome, ${userName}!</h1><p>Thanks for signing up.</p>`;
43
+ await this.emailService.sendEmail(userEmail, 'Welcome', body);
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### Handlebars Templates
49
+
50
+ The module uses `@nestjs-modules/mailer` with a Handlebars adapter. Place templates in `process.cwd() + '/templates/'` and use the MailerService directly for template-based emails (inject `MailerService` from `@nestjs-modules/mailer`).
51
+
52
+ ### Verifying Connection
53
+
54
+ ```typescript
55
+ await this.emailService.verify();
56
+ ```
57
+
58
+ ## Environment Variables
59
+
60
+ | Variable | Description |
61
+ |----------|-------------|
62
+ | `EMAIL_SMTP` | SMTP host |
63
+ | `EMAIL_SMTP_PORT` | SMTP port |
64
+ | `EMAIL_SMTP_USERNAME` | SMTP username |
65
+ | `EMAIL_SMTP_PASSWORD` | SMTP password |
66
+ | `EMAIL_SMTP_DISPLAY_NAME` | From display name (defaults) |
67
+
68
+ ## Exports
69
+
70
+ - `EmailModule` — Register the email module
71
+ - `EmailService` — Send emails and verify connection
72
+ - `EmailConfig` — Mailer configuration factory
73
+
74
+ ## Related Packages
75
+
76
+ - [@zola_do/core](../core) — Shared types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zola_do/email",
3
- "version": "0.1.9",
3
+ "version": "0.1.13",
4
4
  "description": "Email service for NestJS",
5
5
  "author": "zolaDO",
6
6
  "license": "ISC",
@@ -15,7 +15,10 @@
15
15
  "default": "./dist/index.js"
16
16
  }
17
17
  },
18
- "files": ["dist", "README.md"],
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
19
22
  "scripts": {
20
23
  "build": "rimraf dist && tsc",
21
24
  "prepublishOnly": "npm run build"