The wrapper of the @aws-sdk/client-ses which allows to set the shared mail data.
Install the package using the following command:
yarn add @os-team/aws-ses
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.
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);
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.