How to use node-ses - 4 common examples

To help you get started, we’ve selected a few node-ses examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rsnay / wadayano / server / src / email.js View on Github external
const sendEmail = function(to, subject, message) {
    // Log
    console.log('Sending email', to, subject, message);

    const client = ses.createClient({ amazon: AWS_SES_ENDPOINT, key: AWS_SES_KEY, secret: AWS_SES_SECRET });

    client.sendEmail({
        to,
        //to: 'success@simulator.amazonses.com',
        from: AWS_SES_FROM_ADDRESS,
        subject,
        message
    }, function(err, data, res) { console.log(err, data) });

    // TODO should we switch to promise-based SES module to be able to return success/failure?
}
github strapi / strapi / packages / strapi-provider-email-amazon-ses / lib / index.js View on Github external
init: config => {
    var client = nodeSES.createClient({
      key: config.amazon_ses_api_key,
      secret: config.amazon_ses_secret,
      amazon: config.amazon_ses_endpoint,
    });

    return {
      send: (options, cb) => {
        return new Promise((resolve, reject) => {
          // Default values.
          options = _.isObject(options) ? options : {};
          options.from = options.from || config.amazon_ses_default_from;
          options.replyTo =
            options.replyTo || config.amazon_ses_default_replyto;
          options.text = options.text || options.html;
          options.html = options.html || options.text;
github eladnava / facebook-alerts / routes / sync.js View on Github external
return new Promise(function(resolve, reject) {
        // Actually send the email
        ses.sendEmail(email, function(err, data, res) {
            if (err) {
                // Failed
                return reject(err);
            }

            // Success
            return resolve(data);
        });
    });
};
github staart / api / src / helpers / mail.ts View on Github external
import { readFile } from "fs-extra";
import { join } from "path";
import { render } from "mustache";
import marked from "marked";
import { isMatch } from "matcher";
import disposableDomains from "disposable-email-domains/index.json";
import wildcardDomains from "disposable-email-domains/wildcard.json";
import i18n from "../i18n";
import Joi from "@hapi/joi";
import { joiValidate } from "./utils";
import { DISPOSABLE_EMAIL } from "@staart/errors";
import { logError } from "./errors";
import systemInfo from "systeminformation";
import pkg from "../../package.json";

const client = createClient({
  key: SES_ACCESS,
  secret: SES_SECRET,
  amazon: `https://email.${SES_REGION}.amazonaws.com`
});

/**
 * Send a new email using AWS SES
 */
const sendMail = (mail: Mail): Promise =>
  new Promise((resolve, reject) => {
    client.sendEmail(
      mail,
      (error: SendEmailError, data: SendEmailData, response: Response) => {
        if (error) return reject(error);
        resolve(response);
      }

node-ses

Simple Email Sender for Amazon SES with good docs and error handling

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Popular node-ses functions