emailer-kit
v0.0.9
Published
emailer-kit is a versatile and easy-to-use Node.js utility that simplifies email sending using Nodemailer. With a streamlined interface, it provides a set of functions to effortlessly send HTML emails, making it an ideal toolkit for integrating email func
Downloads
25
Maintainers
Readme
emailer-kit
emailer-kit is a Node.js utility for simplifying email sending using Nodemailer. It provides a streamlined interface to easily send HTML emails with Nodemailer configurations.
Features
- 📧 Send HTML emails effortlessly
- 🌐 Compatible with various email service providers
- 🛠️ Simplifies Nodemailer configuration
- 📦 Lightweight and easy to use
- 📚 Supports both es6 modules and commonjs
- 📜 Written in TypeScript
- 🗃️ Coming soon: Support for attachments
Installation
npm install emailer-kit
# or
yarn add emailer-kit
Configuration
emailer-kit uses Nodemailer to send emails. You can configure Nodemailer by setting environment variables
Environment Variables
Create a .env
file in the root of your project and add the following environment variables:
NODEMAIL_SERVICE= [email service provider e.g. 'outlook' or 'gmail' or 'yahoo' etc.]
NODEMAIL_EMAIL= [your email address]
NODEMAIL_PASSWORD= [your email password]
NOTE : If you are using gmail, you need app password. You can create an app password by going to your Google account settings and then to the security tab.
Usage
import { emailer } from "emailer-kit";
// if you are not using commonjs then use require instead of import as shown below
// const { emailer } = require("emailer-kit");
async function sendTestEmail() {
const email = "[email protected]";
const subject = "Test Subject";
const htmlContent = "<p>This is a test email.</p>";
try {
const info = await emailer(email, subject, htmlContent);
console.log("Email sent:", info.response);
} catch (error) {
console.error("Error sending email:", error);
}
}
sendTestEmail();
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
Author
👤 Md Rifat Hossen Saown
- Website: rifatsaown.netlify.app
- Github: @rifatsaown
- LinkedIn: Md Rifat Hossen Saown
- Facebook: Md Rifat Hossen Saown
Show your support
Give a ⭐️ if this project helped you!