Skip to content

Instantly share code, notes, and snippets.

@anir0y
Last active July 11, 2022 14:57
Show Gist options
  • Save anir0y/ae5502ff55d4b936334273dbb5fcc982 to your computer and use it in GitHub Desktop.
Save anir0y/ae5502ff55d4b936334273dbb5fcc982 to your computer and use it in GitHub Desktop.
# 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: ["your@email.com"],
},
Message: {
Body: {
Text: {
Data: `Hello from Lambda!`
},
},
Subject: { Data: `Message from AWS Lambda` },
},
Source: "your@email.com",
};
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