delta-mail v1.0.2
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-mail
If 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: "your-email@gmail.com",
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: "recipient@example.com",
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: ["user1@example.com", "user2@example.com"],
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: "recipient@example.com",
subject: "Welcome to Delta Mail!",
body: emailTemplates.welcome("John Doe"),
isHtml: true,
});
// ā
Password Reset Email
sendMail({
to: "recipient@example.com",
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
open
if 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! š