@os-team/aws-ses
TypeScript icon, indicating that this package has built-in type declarations

1.0.41 • Public • Published

@os-team/aws-ses NPM version BundlePhobia

The wrapper of the @aws-sdk/client-ses which allows to set the shared mail data.

Usage

Step 1. Install the package

Install the package using the following command:

yarn add @os-team/aws-ses

Step 2. Set AWS environment variables

To make requests to AWS you need to create the access key ID and secret access key in the AWS Management Console. Follow these instructions.

The AWS SDK automatically detects credentials from AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. So you can set it. See more here.

Step 3. Create an instance of AwsSes

The shared mail data will be used when sending each email.

const sharedMailData = {
  Source: 'Company <name@m.domain.com>',
  ReplyToAddresses: ['support@domain.com'],
};

const mailer = new AwsSes({ region: 'us-east-1' }, sharedMailData);

Step 4. Send an email

const sent = await mailer.send({
  Destination: {
    ToAddresses: ['user@domain.com'],
  },
  Message: {
    Subject: {
      Charset: 'UTF-8',
      Data: 'Subject',
    },
    Body: {
      Text: {
        Charset: 'UTF-8',
        Data: 'Message',
      },
    },
  },
});

See about sending emails in the Amazon SES documentation.

Readme

Keywords

none

Package Sidebar

Install

npm i @os-team/aws-ses

Weekly Downloads

6

Version

1.0.41

License

MIT

Unpacked Size

6.37 kB

Total Files

8

Last publish

Collaborators

  • oxilor