https://github.com/adamgibbons/serverless-mailer
https://github.com/adamgibbons/serverless-mailer
aws-lambda aws-ses email-sender mailer node-mailer nodejs serverless serverless-framework
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/adamgibbons/serverless-mailer
- Owner: adamgibbons
- Created: 2017-10-07T17:11:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-09T17:58:09.000Z (over 8 years ago)
- Last Synced: 2025-04-22T18:57:03.616Z (10 months ago)
- Topics: aws-lambda, aws-ses, email-sender, mailer, node-mailer, nodejs, serverless, serverless-framework
- Language: JavaScript
- Size: 2.93 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# serverless-mailer
Send email using Serverless and several AWS products (Lambda, SES, API Gateway).
## Install and setup
Clone the Github repo:
```bash
git clone git@github.com:adamgibbons/serverless-mailer.git
```
Change into the project's directory and install dependencies
```bash
cd serverless-mailer && npm install
```
Rename `config.copy.json` to `config.json`.
```bash
mv config.copy.json config.json
```
Open `config.json` and add your AWS credentials for the `accessKeyId` and `secretAccessKey` fields.
*Note - this file won't be tracked by Git or published to Github.*
## Deploy and use
Deploy to serverless:
```bash
sls deploy -v
```
Once the package has deployed, Serverless will write log information to the terminal,
including a POST endpoint.
Send a POST request to that endpoint with a JSON body.
Full request body structure:
```json
{
"bccEmailAddresses": ["foo@example.com"],
"ccEmailAddresses": ["bar@example.com"],
"toEmailAddresses": ["baz@example.com"],
"bodyData": "...and email goes here!",
"bodyCharset": "UTF-8",
"subjectdata": "Subject goes here",
"subjectCharset": "UTF-8",
"sourceEmail": "baz@example.com",
"replyToAddresses": ["baz@example.com"]
}
```
Curl example:
```bash
curl -d '{"toEmailAddresses":["recipient@example.com"], "subjectdata":"bar", "sourceEmail":"sam.morse@example.com", "bodyData":"What hath God wrought?"}' -H "Content-Type: application/json" -X POST https://.execute-api.us-east-1.amazonaws.com/dev/send
```