@flutry/mail 0.0.1
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 +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.js +35 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @flutry/main
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
The heart and soul of the Flutry framework.
|
|
6
|
+
|
|
7
|
+
This package provides the main infrastructure for server initialization and integration with other Flutry modules (e.g., @flutry/fastify, etc.).
|
|
8
|
+
|
|
9
|
+
## 🔧 Features
|
|
10
|
+
|
|
11
|
+
- Dynamic adapter loading (`fastify`)
|
|
12
|
+
- Unified configuration system
|
|
13
|
+
- Basic lifecycle management in the Flutry project
|
|
14
|
+
|
|
15
|
+
## 🚀 Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { Flutry } from '@flutry/main';
|
|
19
|
+
new Flutry().CreateInstance(); // Automatically selects the server based on the .env file
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 📄 Licenc
|
|
23
|
+
|
|
24
|
+
MIT
|
|
25
|
+
|
|
26
|
+
## 🌐 Website
|
|
27
|
+
|
|
28
|
+
The official website of the package: [https://flutry.com/docs/package/main](https://flutry.com/docs/package/main)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FlutryMail } from './main';
|
package/dist/index.js
ADDED
package/dist/main.d.ts
ADDED
package/dist/main.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FlutryMail = void 0;
|
|
7
|
+
require("dotenv/config");
|
|
8
|
+
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
9
|
+
class FlutryMail {
|
|
10
|
+
static async sendMail(from, to, subject, html) {
|
|
11
|
+
if (!process.env.SMTP_HOST || !process.env.SMTP_PORT || !process.env.SMTP_USER || !process.env.SMTP_PASS) {
|
|
12
|
+
throw new Error('All SMTP_HOST, SMTP_PORT, SMTP_USER and SMTP_PASS environment variables are required.');
|
|
13
|
+
}
|
|
14
|
+
if (!from || !to || !subject || !html) {
|
|
15
|
+
throw new Error('All from, to, subject and html parameters are required.');
|
|
16
|
+
}
|
|
17
|
+
const transporter = nodemailer_1.default.createTransport({
|
|
18
|
+
host: process.env.SMTP_HOST,
|
|
19
|
+
port: Number(process.env.SMTP_PORT),
|
|
20
|
+
secure: process.env.SMTP_PORT === '465',
|
|
21
|
+
auth: {
|
|
22
|
+
user: process.env.SMTP_USER,
|
|
23
|
+
pass: process.env.SMTP_PASS,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const info = await transporter.sendMail({
|
|
27
|
+
from,
|
|
28
|
+
to,
|
|
29
|
+
subject,
|
|
30
|
+
html,
|
|
31
|
+
});
|
|
32
|
+
return info;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.FlutryMail = FlutryMail;
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flutry/mail",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"dotenv": "^17.2.3",
|
|
15
|
+
"nodemailer": "^7.0.10"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^24.7.0",
|
|
19
|
+
"@types/nodemailer": "^7.0.3",
|
|
20
|
+
"typescript": "^5.9.3"
|
|
21
|
+
}
|
|
22
|
+
}
|