在 Amazon SES 中接收来自特定域的电子邮件

Receiving emails from specific domain in Amazon SES

有没有办法让我只允许从 Amazon SES 中的特定域接收电子邮件。例如 - 我只想接受来自域 abc.com 的电子邮件并拒绝来自不同域的任何其他邮件。

是的!

您可以在收到电子邮件时调用 Lambda 函数,本文更详细地解释了该过程。

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda.html

来自那个文件

Writing Your Lambda Function

To process your email, your Lambda function can be invoked asynchronously (that is, using the Event invocation type). The event object passed to your Lambda function will contain metadata pertaining to the inbound email event. You can also use the metadata to access the message content from your Amazon S3 bucket.

If you want to actually control the mail flow, your Lambda function must be invoked synchronously (that is, using the RequestResponse invocation type) and your Lambda function must call the callback method with two arguments: the first argument is null, and the second argument is a disposition property that is set to either STOP_RULE, STOP_RULE_SET, or CONTINUE. If the second argument is null or does not have a valid disposition property, the mail flow continues and further actions and rules are processed, which is the same as with CONTINUE.

For example, you can stop the receipt rule set by writing the following line at the end of your Lambda function code:

callback( null, { "disposition" : "STOP_RULE_SET" });