bsh-aws-ses-send

Send an email using Amazon AWS SES with your credentials in AWS environment variables, in the Credentials file, or passed by argument. Returns a Promise.

Usage no npm install needed!

<script type="module">
  import bshAwsSesSend from 'https://cdn.skypack.dev/bsh-aws-ses-send';
</script>

README

bsh-aws-ses-send provides basic capability to send an email using SES. Credentials can either be passed in (not recommend) or set per ASWS documentation in environment variables or in the credentials file.

=====

install: npm install bsh-aws-ses-send

=====

usage:

var sendEmail = require ('bsh-aws-ses-send')(region, credentialsProfile, accessKeys);

WHERE:

sendEmail is a function that returns a Promise

region = AWS region (string) - required

credentialsProfile = AWS profile in the AWS credentials file - optional

accessKeys = {accessKeyId: 'your access key', secretAccessKey: 'your secret access key'} - optional

If you don't provide credentialsProfile or accessKeys, the module will attempt to load access keys from the environment using AWS environment parameters:

AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY

            OR

AMAZON_ACCESS_KEY_ID AMAZON_SECRET_ACCESS_KEY

The returned Promise's success value is the AWS return object, which is often of little interest. The returned Promise's failure value is either a validation Error or an AWS error object

=====

Invoke sendMail as follows:

sendMail(email).then(function(successVal) { // Success code }, function(errorVal) { // Error code });

WHERE:

var email = {from:'from email address', // required toAddresses: ['toAddress1','toAddress2'], // optional ccAddresses: ['toAddress1','toAddress2'], // optional bccAddresses: ['toAddress1','toAddress2'], // optional subject: 'subject', // required textBody: 'textBody', // optional htmlBody: 'htmlBody' // optional };