1.0.0 • Published 6 months ago

@ashkiani/aws-ses-mailer v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

aws-ses-mailer

Lightweight AWS SES email sender for Node.js — simple utility to send HTML/text emails with optional reply-to, built on AWS SDK v3.

@ashkiani/aws-ses-mailer

Simple and reusable AWS SES email sender for Node.js apps using the AWS SDK v3.

This utility wraps common email-sending functionality with support for plain text, HTML, subject, and reply-to addresses — ideal for backend services, alerts, and transactional email delivery.


📦 Installation

npm install @ashkiani/aws-ses-mailer
```bash

---

## 🛠 Usage

1. Set your environment variable:

```env
AWS_REGION=us-east-1
  1. Import and use the module:
const mailer = require('@ashkiani/aws-ses-mailer');

await mailer.sendMail(
    "recipient@example.com",
    "sender@yourdomain.com",
    "This is the plain text body",
    "<p>This is the <strong>HTML</strong> body</p>",
    "Test Email Subject",
    "replyto@yourdomain.com"
);

📘 API

sendMail(to, from, textBody, htmlBody, subject, replyTo)

ParamTypeDescription
tostringRecipient email address
fromstringSender email (must be SES verified)
textBodystringPlain text version of the email body
htmlBodystringHTML version of the email body
subjectstringEmail subject line
replyTostring(Optional) Reply-to address

Returns an SES send result object on success.


💡 Notes

  • Built using @aws-sdk/client-ses.
  • Sender (from) address must be verified in your AWS SES setup.
  • Supports both HTML and plain text emails for better deliverability.
  • You can add CcAddresses or multiple recipients by modifying the source code if needed.

📄 License

MIT © Siavash Ashkiani