npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aws-lambda-ses-mailer

v1.0.3

Published

Reusable AWS Lambda email handler with SES and reCAPTCHA verification

Readme

aws-lambda-ses-mailer

Reusable AWS Lambda handler that validates incoming contact-form requests, verifies Google reCAPTCHA tokens, and forwards the message via Amazon SES v2.

Installation

npm install aws-lambda-ses-mailer
# or
yarn add aws-lambda-ses-mailer

The package ships ESM output and targets Node.js 18+, matching current Lambda runtimes.

Quick Start

import { APIGatewayProxyHandlerV2 } from "aws-lambda";
import { createSendMailHandler } from "aws-lambda-ses-mailer";

const sendMail = createSendMailHandler({
  region: "us-west-2",
  senderEmail: "[email protected]",
  recipientEmail: "[email protected]",
  recaptchaSecret: process.env.RECAPTCHA_SECRET,
});

export const handler: APIGatewayProxyHandlerV2 = async (event, context, callback) => {
  return sendMail(event, context, callback);
};

Deploy the exported handler in your AWS Lambda function behind an API Gateway endpoint that accepts JSON or multipart/form-data POST bodies.

Handler Configuration

| Option | Required | Description | | ----------------- | -------- | -------------------------------------------------------------------------------------------- | | senderEmail | ✅ | Email address shown as the sender when SES sends the message. | | recipientEmail | ✅ | Destination address that receives the forwarded message. | | region | ➖ | AWS region for the SES client (defaults to us-west-2). | | recaptchaSecret | ➖ | Secret key for Google reCAPTCHA v2/v3 verification. Set to undefined to disable checks. | | skipRecaptcha | ➖ | Set to true to bypass reCAPTCHA verification without supplying a secret (useful in tests). | | disableSend | ➖ | When true, skips the SES send call but still returns success (useful in CI/test). |

The handler validates incoming payloads with AJV. A valid request must include:

{
  "name": "Sender Name",
  "email": "[email protected]",
  "subject": "Hello",
  "message": "Body text",
  "recaptcha": "token-from-client"
}

Requests sent with multipart/form-data can also include file attachments. Each file is streamed into memory as a Buffer and forwarded to SES as an attachment.

Local Development

Clone the repository and install dependencies:

npm install

Available scripts:

  • npm run build – Compile TypeScript sources into dist/.
  • npm test – Run the Jest test suite (uses node --experimental-vm-modules to execute ESM tests).

Before publishing, ensure npm run build completes without errors and that the generated dist/ artifacts look as expected.

Testing Notes

The included tests exercise the handler with disableSend: true. When writing your own tests, prefer the same flag or mock Nodemailer to avoid hitting SES.

To generate a realistic event payload for manual testing, use the API Gateway Lambda proxy structure and provide either a JSON body or a base64-encoded multipart payload.

License

MIT © Kenton Chun