emailer-kit v0.0.9
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@example.com";
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!