ReceiptFilter
The ReceiptFilter resource lets you manage AWS SES ReceiptFilters for controlling which IP addresses can send mail to your Amazon SES account.
Minimal Example
Section titled “Minimal Example”Create a basic receipt filter that allows a specific IP address to send emails.
import AWS from "alchemy/aws/control";
const basicReceiptFilter = await AWS.SES.ReceiptFilter("basic-receipt-filter", { Filter: { Name: "AllowSpecificIP", IpFilter: { IpAddress: "203.0.113.0/24", Policy: "Allow" } }});
Advanced Configuration
Section titled “Advanced Configuration”Configure a receipt filter with an additional option to adopt an existing resource if it already exists.
const advancedReceiptFilter = await AWS.SES.ReceiptFilter("advanced-receipt-filter", { Filter: { Name: "AllowMultipleIPs", IpFilter: { IpAddress: "198.51.100.0/24", Policy: "Allow" } }, adopt: true // Adopt the existing receipt filter if it is already present});
Example with Deny Policy
Section titled “Example with Deny Policy”Create a receipt filter that denies a specific IP address from sending emails.
const denyReceiptFilter = await AWS.SES.ReceiptFilter("deny-receipt-filter", { Filter: { Name: "DenySpecificIP", IpFilter: { IpAddress: "192.0.2.0/24", Policy: "Deny" } }});
Example with Multiple Filters
Section titled “Example with Multiple Filters”You can create multiple receipt filters to manage different sets of IP addresses.
const multipleFilters = await AWS.SES.ReceiptFilter("multiple-filters", { Filter: { Name: "CombinedFilters", IpFilter: { IpAddress: "203.0.113.0/24", Policy: "Allow" } }, adopt: true // This will adopt existing resources if any});
// Adding another filterconst secondFilter = await AWS.SES.ReceiptFilter("deny-filter", { Filter: { Name: "DenyIPRange", IpFilter: { IpAddress: "192.0.2.0/24", Policy: "Deny" } }});