1.0.2 • Published 4 months ago

delta-mail v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

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! šŸš€

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago