mailer-advance 1.0.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/README.md +67 -0
- package/dist/server.js +159823 -0
- package/package.json +54 -0
- package/public/config.html +380 -0
- package/public/contact.html +319 -0
- package/public/list-configs.html +289 -0
- package/src/app.js +23 -0
- package/src/config/mail.config.js +18 -0
- package/src/config/swagger.config.js +29 -0
- package/src/models/smtpConfig.model.js +59 -0
- package/src/repositories/base.repository.js +17 -0
- package/src/repositories/mongo.repository.js +27 -0
- package/src/repositories/sql.repository.js +86 -0
- package/src/routes/config.routes.js +128 -0
- package/src/routes/contact.routes.js +91 -0
- package/src/server.js +28 -0
- package/src/services/database.factory.js +19 -0
- package/src/services/db.service.js +68 -0
- package/src/services/mail.service.js +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @pranay/mailer-advance
|
|
2
|
+
|
|
3
|
+
Advanced Node.js email service with dynamic SMTP configuration, multi-database support (MongoDB/PostgreSQL/MySQL), and a built-in UI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multi-DB Support**: Store SMTP settings in MongoDB, PostgreSQL, or MySQL.
|
|
8
|
+
- **Dynamic Configuration**: Change SMTP servers on-the-fly via API or UI.
|
|
9
|
+
- **Built-in UI**: Modern, dark-mode interface for sending emails and managing configurations.
|
|
10
|
+
- **Secure**: TLS support with explicit control over certificate validation.
|
|
11
|
+
- **Attachments**: Full support for file attachments and embedded images.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### 1. Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/your-repo/mailer-advance
|
|
19
|
+
cd mailer-advance
|
|
20
|
+
npm install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2. Environment Setup
|
|
24
|
+
|
|
25
|
+
Create a `.env` file in the root:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
PORT=3000
|
|
29
|
+
DB_TYPE=mongodb # options: mongodb, postgres, mysql
|
|
30
|
+
DB_URI=mongodb://localhost:27017/mail_service_db
|
|
31
|
+
|
|
32
|
+
# Default SMTP (Fallback)
|
|
33
|
+
MAIL_HOST=smtp.example.com
|
|
34
|
+
MAIL_PORT=587
|
|
35
|
+
MAIL_SECURE=false
|
|
36
|
+
MAIL_USER=user@example.com
|
|
37
|
+
MAIL_PASS=password
|
|
38
|
+
MAIL_FROM_NAME="Service Name"
|
|
39
|
+
MAIL_FROM_EMAIL=noreply@example.com
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 3. Run the Service
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Development
|
|
46
|
+
npm run dev
|
|
47
|
+
|
|
48
|
+
# Production
|
|
49
|
+
npm run build
|
|
50
|
+
npm start
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
### User Interface
|
|
56
|
+
- **Send Email**: `http://localhost:3000/contact.html`
|
|
57
|
+
- **List Configs**: `http://localhost:3000/list-configs.html`
|
|
58
|
+
- **Add Config**: `http://localhost:3000/config.html`
|
|
59
|
+
|
|
60
|
+
### API Headers
|
|
61
|
+
Send a `POST` request to `/api/contact` with:
|
|
62
|
+
- `configId`: (Optional) ID of a saved SMTP configuration.
|
|
63
|
+
- `to`: Recipient email.
|
|
64
|
+
- `attachments`: Files (multipart/form-data).
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
MIT
|