- Node.js (>= 8.11.0)
- npm (>= 5.8.0)
Check engines field in package.json
- Node.js & npm
- Serverless
- Clone this repo
- Run
npm installin the repo directory - App is configured via environment variables contained in a file named
.env. Use the.env.examplefile as a template:cp .env.example .envand enter configuration details. - For other scripts run
npm run
- Verify domain & email
- Create SNS topic & after lambda deployment, add SNS topic as lambda trigger.
- Adjust configuration sets (set SNS topic for
delivery) - Create S3 bucket, and allow SES actions in bucket policy (Be sure to add
Get,Put,Delete&Listbucket actions) - Create
mail receiving rule sets(First rule isS3bucket, second islambda) - After lambda deployment, go to IAM console, create role with
AWSLambdaFullAccess&AmazonSESFullAccesspermissions - Important: Copy role
arntoserverless.ymlconfig!
IMPORTANT 👉 Be sure that S3 bucket is empty before sending any mails.
- Create
seedfolder - Create
.jsonfile that represents AWS SES mocked event(mail receiving).
SES event example 👇
{
"Records": [
{
"EventSource": "aws:ses",
"EventVersion": "1.0",
"ses": {
"mail": {
"timestamp": "2020-09-30T06:13:48.251Z",
"source": "<allowed_source_email_address>",
"messageId": "<incoming_message_id>",
"headersTruncated": false
},
"receipt":{
"timestamp": "2020-09-30T06:13:48.251Z",
"processingTimeMillis": 518
}
}
}
]
}- Invoke lambda function locally by running
npm run invoke:local <path>
serverless deployor with shorthandsls deploy