:doc:`SES <../../ses>` / Client / create_receipt_filter

*********************
create_receipt_filter
*********************



.. py:method:: 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 <https://docs.aws.amazon.com/ses/latest/dg/receiving-email-ip-filtering-console-walkthrough.html>`__.

   

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

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/email-2010-12-01/CreateReceiptFilter>`_  


  **Request Syntax**
  ::

    response = client.create_receipt_filter(
        Filter={
            'Name': 'string',
            'IpFilter': {
                'Policy': 'Block'|'Allow',
                'Cidr': 'string'
            }
        }
    )
    
  :type Filter: dict
  :param Filter: **[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 <https://tools.ietf.org/html/rfc2317>`__.

        

      
    
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 

      An empty element returned on a successful request.

      
  
  **Exceptions**
  
  *   :py:class:`SES.Client.exceptions.LimitExceededException`

  
  *   :py:class:`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': {
            '...': '...',
        },
    }

  