Friday, February 28, 2020

Amazon SES notes

Amazon IAM policy to restrict sending email from a single address

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ses:SendRawEmail",
      "Resource": "*",
      "Condition": {
        "StringLike": {
          "ses:FromAddress": "username@domain.com"
        }
      }
    }
  ]
}

Replace `username@domain.com` with `*@domain.com` to allow sending from any addresses.

Generate SMTP password from the secret access key

Official document is available at docs.aws.amazon.com. Usage is like this:

./ses.py --secret DmxxxOY --region us-west-2


Test SMTP credentials

I use the swaks script (source: wiert.me):

brew install swaks

swaks -tls --to xxx@gmail.com \
  --from username@domain.com \
  --server email-smtp.us-west-2.amazonaws.com \
  --auth-user AKxxxOP


If everything is setup correctly, you should receive the test email in your inbox.


No comments:

Post a Comment