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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nodemail-aws-ses

v1.0.4

Published

nodemail-aws-ses is a Node.js package that provides a simple and easy way to send emails using Amazon SES (Simple Email Service). It provides an EmailSender class that takes care of sending emails using the AWS SDK, with options for both HTML and text ema

Downloads

112

Readme

Nodemail AWS SES

Nodemail AWS SES is a Node.js package that provides a simple and easy way to send emails using Amazon SES (Simple Email Service). It provides an EmailSender class that takes care of sending emails using the AWS SDK, with options for both HTML and text emails.

Prerequisites

  • Node.js installed on your system
  • An AWS account with SES enabled
  • AWS credentials with permissions to use SES

Installation

  npm install nodemail-aws-ses

Usage

First, you need to set up your AWS credentials in a .env file or through environment variables. You can use the following format in your .env.example file inside example directory:

  AWS_ACCESS_KEY_ID=your_access_key
  AWS_SECRET_ACCESS_KEY=your_secret_access_key
  AWS_REGION=your_aws_region
  [email protected]

Basic Example

Go to example directory and run the following command: make sure you create .env file from env.example.

cd example
node example.js

Example with Express.js

Create an Express.js application and use the package to send emails through a POST request.

  1. Install Express and body-parser:
npm install express body-parser
  1. Create an app.js file with the following content:
const express = require("express");
const bodyParser = require("body-parser");
const EmailSender = require("nodemail-aws-ses");

const app = express();
app.use(bodyParser.json());

app.post("/send-email", (req, res) => {
  const { to, subject, bodyText, bodyHtml } = req.body;

  const emailSender = new EmailSender(to, subject, bodyText, bodyHtml);
  emailSender
    .send()
    .then(() => {
      res.status(200).json({ message: "Email sent successfully" });
    })
    .catch((error) => {
      console.error("Error sending email:", error);
      res.status(500).json({ error: "Failed to send email" });
    });
});

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});
  1. Start your Express.js application:
node app.js
  1. Send a POST request to the /send-email endpoint with the required parameters:
{
  "to": "[email protected]",
  "subject": "Welcome to My App",
  "bodyText": "Thank you for signing up!",
  "bodyHtml": "<h1>Thank you for signing up!</h1>"
}

For more examples and usage details, please refer to the example directory.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome. Please submit a pull request or open an issue if you encounter any problems or have suggestions for improvements.