1.0.0 • Published 6 months ago
@ashkiani/aws-ses-mailer v1.0.0
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- 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)
| Param | Type | Description |
|---|---|---|
to | string | Recipient email address |
from | string | Sender email (must be SES verified) |
textBody | string | Plain text version of the email body |
htmlBody | string | HTML version of the email body |
subject | string | Email subject line |
replyTo | string | (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
CcAddressesor multiple recipients by modifying the source code if needed.
📄 License
MIT © Siavash Ashkiani
1.0.0
6 months ago