@jubayer_shuvo/mailer-js
Version:
A lightweight and easy-to-use Node.js mailer utility supporting TypeScript and JavaScript.
85 lines (59 loc) • 2.28 kB
Markdown
# 📬 @jubayer_shuvo/mailer-js
[](https://www.npmjs.com/package/@jubayer_shuvo/mailer-js)
[](LICENSE)
[](https://nodejs.org/)
[](https://github.com/jubayershuvo/mailer-js/actions)
[](https://github.com/jubayershuvo/mailer-js)
> A lightweight and easy-to-use Node.js mailer utility supporting TypeScript and JavaScript.
## ✨ Features
- 🚀 Simple and minimal API
- 📦 Works with both CommonJS and ESModules
- 📜 Written in TypeScript
- 💌 Send emails with just one function
## 📦 Installation
```bash
npm install @jubayer_shuvo/mailer-js
# or
yarn add @jubayer_shuvo/mailer-js
```
## Get Api for free
[Click here](https://mailer-js.vercel.app)
## 🚀 Usage
### ✅ CommonJS (Node.js)
```js
const sendMail = require("@jubayer_shuvo/mailer-js");
sendMail({
apiKey: "your-api-key",
to: "recipient@example.com",
subject: "Hello!",
text: "This is a test email.",
})
.then(() => console.log("Email sent successfully!"))
.catch(console.error);
```
### ✅ ESModules / TypeScript
```ts
import sendMail from "@jubayer_shuvo/mailer-js";
await sendMail({
apiKey: "your-api-key",
to: "recipient@example.com",
subject: "Hello!",
text: "This is a test email.",
});
```
## 📄 API
### `sendMail(options: SendMailOptions): Promise<{ success: boolean }>`
#### Parameters:
| Name | Type | Required | Description |
|----------|----------|----------|--------------------------|
| `apiKey` | `string` | ✅ | Your email API key |
| `to` | `string` | ✅ | Recipient email address |
| `subject`| `string` | ✅ | Email subject |
| `text` | `string` | ✅ | Email plain text content |
## 📃 License
MIT © [Md Jubayer](https://github.com/jubayershuvo)