-
-
Save anir0y/ae5502ff55d4b936334273dbb5fcc982 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# edit IAM | |
link : https://us-east-1.console.aws.amazon.com/iam/home#/policies$new?step=edit | |
json blob: | |
```json | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"ses:SendEmail", | |
"ses:SendRawEmail" | |
], | |
"Resource": "*" | |
} | |
] | |
} | |
``` | |
### custom msg block | |
const aws = require("aws-sdk"); | |
const ses = new aws.SES({ region: "us-east-1" }); | |
exports.handler = async function (event) { | |
console.log('EVENT: ', event) | |
const params = { | |
Destination: { | |
ToAddresses: ["[email protected]"], | |
}, | |
Message: { | |
Body: { | |
Text: { | |
Data: `Hello from Lambda!` | |
}, | |
}, | |
Subject: { Data: `Message from AWS Lambda` }, | |
}, | |
Source: "[email protected]", | |
}; | |
return ses.sendEmail(params).promise() | |
}; | |
# req code | |
{ | |
"body":{ | |
"SenderName": "ROy", | |
"SenderEmail": "mail@", | |
"message": "It works!" | |
} | |
} | |
# api end-point | |
https://es38dec7vg.execute-api.us-east-1.amazonaws.com/default/sendMail | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment