SES / Client / create_receipt_filter

create_receipt_filter#

SES.Client.create_receipt_filter(**kwargs)#

Creates a new IP address filter.

For information about setting up IP address filters, see the Amazon SES Developer Guide.

You can execute this operation no more than once per second.

See also: AWS API Documentation

Request Syntax

response = client.create_receipt_filter(
    Filter={
        'Name': 'string',
        'IpFilter': {
            'Policy': 'Block'|'Allow',
            'Cidr': 'string'
        }
    }
)
Parameters:

Filter (dict) –

[REQUIRED]

A data structure that describes the IP address filter to create, which consists of a name, an IP address range, and whether to allow or block mail from it.

  • Name (string) – [REQUIRED]

    The name of the IP address filter. The name must meet the following requirements:

    • Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).

    • Start and end with a letter or number.

    • Contain 64 characters or fewer.

  • IpFilter (dict) – [REQUIRED]

    A structure that provides the IP addresses to block or allow, and whether to block or allow incoming mail from them.

    • Policy (string) – [REQUIRED]

      Indicates whether to block or allow incoming mail from the specified IP addresses.

    • Cidr (string) – [REQUIRED]

      A single IP address or a range of IP addresses to block or allow, specified in Classless Inter-Domain Routing (CIDR) notation. An example of a single email address is 10.0.0.1. An example of a range of IP addresses is 10.0.0.1/24. For more information about CIDR notation, see RFC 2317.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

    An empty element returned on a successful request.

Exceptions

  • SES.Client.exceptions.LimitExceededException

  • SES.Client.exceptions.AlreadyExistsException

Examples

The following example creates a new IP address filter:

response = client.create_receipt_filter(
    Filter={
        'IpFilter': {
            'Cidr': '1.2.3.4/24',
            'Policy': 'Allow',
        },
        'Name': 'MyFilter',
    },
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}