delta-mail
v1.0.2
Published
A simple email sending service built on top of Nodemailer.
Downloads
89
Readme
delta-mail 📧
A simple and powerful email sending service built on Nodemailer with:
✅ Easy Setup with configureMail()
✅ Send Emails Easily with sendMail()
✅ Bulk Email Support with sendBulkMail()
✅ Predefined Email Templates for quick use
✅ Attachments Support
✅ Email Preview Feature
📌 Installation
Install via NPM:
npm install delta-mailIf you want to preview emails before sending, install:
npm install open🚀 Usage
1️⃣ Configure Your SMTP Settings
import { configureMail } from "delta-mail";
configureMail({
host: "smtp.gmail.com",
port: 587,
secure: false,
auth: {
user: "[email protected]",
pass: "your-app-password", // You will get your 16 digit password from google app password once you create an App
},
});2️⃣ Send an Email
import { sendMail } from "delta-mail";
sendMail({
to: "[email protected]",
subject: "Hello from Delta Mail!",
body: "<h1>This is a test email from delta-mail.</h1>",
isHtml: true,
})
.then((response) => console.log("✅ Email sent successfully!", response))
.catch((error) => console.error("❌ Email failed!", error));3️⃣ Send Bulk Emails
import { sendBulkMail } from "delta-mail";
sendBulkMail({
recipients: ["[email protected]", "[email protected]"],
subject: "Special Offer for You!",
body: "<p>Enjoy a 20% discount. Limited time only!</p>",
isHtml: true,
})
.then(() => console.log("✅ Bulk emails sent successfully!"))
.catch((error) => console.error("❌ Bulk email sending failed!", error));4️⃣ Preview an Email Before Sending
import { previewEmail, emailTemplates } from "delta-mail";
previewEmail(emailTemplates.welcome("John Doe"));✅ This will open a preview of the email in your browser.
📜 Predefined Email Templates
🚀 Use built-in email templates to save time!
import { sendMail, emailTemplates } from "delta-mail";
// ✅ Welcome Email
sendMail({
to: "[email protected]",
subject: "Welcome to Delta Mail!",
body: emailTemplates.welcome("John Doe"),
isHtml: true,
});
// ✅ Password Reset Email
sendMail({
to: "[email protected]",
subject: "Reset Your Password",
body: emailTemplates.passwordReset("https://reset-link.com"),
isHtml: true,
});📌 Available Templates
✅ Welcome Email
✅ Password Reset
✅ Order Shipped
✅ Event Invitation
✅ Feedback Request
✅ Account Deactivation Warning
✅ Referral Program Invitation
✅ Thank You for Purchase
✅ Special Offer / Discount Notification
📌 Notes
- If using Gmail, generate an App Password instead of your normal password.
- Ensure your SMTP provider allows external apps to send emails.
- Install
openif using the preview feature:npm install open
📜 License
This project is licensed under the MIT License.
💻 Contributing
Feel free to submit issues and pull requests on GitHub.
Happy coding! 🚀
