Search code examples
amazon-web-servicesamazon-ses

Unable to receive email in AWS SES using SNS and Lambda


I'm trying to receive email in SES using SNS and a Lambda function.

I have verified [email protected] as an email address in SES and I have created a rule set with [email protected] as the recipient and an SNS topic as the action. The rule set is enabled.

The Lambda is subscribed to the SNS topic and when I send a test message in the AWS console on the topic, I can see in CloudWatch that the Lambda got the message.

However, when I send an email to [email protected], the Lambda doesn't get the email.

Any ideas?

Below are some related code/config:

  • SES verified email SES verified email
  • Receipt rule action Receipt rule action
  • SNS topic access policy
{
  "Version": "2008-10-17",
  "Id": "__default_policy_ID",
  "Statement": [
    {
      "Sid": "__default_statement_ID",
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": [
        "SNS:GetTopicAttributes",
        "SNS:SetTopicAttributes",
        "SNS:AddPermission",
        "SNS:RemovePermission",
        "SNS:DeleteTopic",
        "SNS:Subscribe",
        "SNS:ListSubscriptionsByTopic",
        "SNS:Publish",
        "SNS:Receive"
      ],
      "Resource": "arn:aws:sns:eu-west-1:my-account-id:EmailImagesStack-TopicBFC7AF6E-8ZD350QFNU12",
      "Condition": {
        "StringEquals": {
          "AWS:SourceOwner": "my account id"
        }
      }
    }
  ]
}

Solution

  • Receive mail in SES require some prerequisites describes in here.

    • Verify your domain with Amazon SES by publishing DNS records to prove that you own it.
    • Permit Amazon SES to receive email for your domain by publishing an MX record.
    • Give Amazon SES permission to access other AWS resources in order to execute receipt rule actions.

    I guess you don't owning domain gmail.com, so SES can not receive mail for you from [email protected].