UNPKG

@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
# 📬 @jubayer_shuvo/mailer-js [![NPM version](https://img.shields.io/npm/v/@jubayer_shuvo/mailer-js.svg)](https://www.npmjs.com/package/@jubayer_shuvo/mailer-js) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Node.js](https://img.shields.io/badge/node-%3E%3D14.0.0-brightgreen.svg)](https://nodejs.org/) [![Build](https://img.shields.io/github/actions/workflow/status/jubayershuvo/mailer-js/publish.yml?label=build)](https://github.com/jubayershuvo/mailer-js/actions) [![GitHub stars](https://img.shields.io/github/stars/jubayershuvo/mailer-js.svg?style=social)](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)