@os-team/aws-ses
v1.0.41
Published
The wrapper of the @aws-sdk/client-ses which allows to set the shared mail data.
Downloads
72
Readme
@os-team/aws-ses
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 <[email protected]>',
ReplyToAddresses: ['[email protected]'],
};
const mailer = new AwsSes({ region: 'us-east-1' }, sharedMailData);
Step 4. Send an email
const sent = await mailer.send({
Destination: {
ToAddresses: ['[email protected]'],
},
Message: {
Subject: {
Charset: 'UTF-8',
Data: 'Subject',
},
Body: {
Text: {
Charset: 'UTF-8',
Data: 'Message',
},
},
},
});
See about sending emails in the Amazon SES documentation.