0.0.5 • Published 9 months ago

@vim-crouwel/aws_util v0.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

EmailUtil

EmailUtil is a utility for sending emails via AWS SES. It is simple, flexible, and easy to integrate.

Installation

npm install @aws-sdk/client-ses

Usage

Import and Initialize

import { EmailUtil } from "./path-to-email-util";

const emailUtil = new EmailUtil(
    { region: "us-east-1" }, // SES config
    "verified-email@example.com" // Verified sender email
);

Send an Email

const response = await emailUtil.send(
    "recipient@example.com",
    "Subject",
    "<p>Message content</p>", // Use plain text if isHtml = false
    true // Default is true for HTML emails
);

console.log(response);

Response Examples

Success:

{
    "success": true,
    "result": "<MessageId>"
}

Failure:

{
    "success": false,
    "result": "Invalid email address"
}

Prerequisites

  • AWS credentials must be configured.
  • The sender email must be verified in AWS SES.

Notes

  • Match the AWS region with your SES setup.
  • Lift sandbox restrictions for production use.

License

MIT License.

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago