Home > front end >  AWS SES - Listing email identities with AWS Lambda
AWS SES - Listing email identities with AWS Lambda

Time:10-18

I'm sending emails to verified identities in AWS SES with ASW Lambda without problems. Now I'm just trying to list verified identities and getting no response.

Here is my code:

import boto3
from botocore.exceptions import ClientError

def list_identities():
    ses = boto3.client('ses')
    response = ses.list_identities(
      IdentityType = 'EmailAddress',
      MaxItems=10
    )

def lambda_handler(event, context):
    # TODO implement
    print("Listing EMAILS:")
    list_identities()

In function log I see printed Listing email: and nothing else. Lambda function is invoked in same region as AWS SES.

CodePudding user response:

You don't return anything from your function.

Try this:

import boto3


def list_identities():
    ses = boto3.client('ses')
    response = ses.list_identities(
        IdentityType='EmailAddress',
        MaxItems=10
    )
    print(response)


def lambda_handler(event, context):
    # TODO implement
    print("Listing EMAILS:")
    list_identities()
  • Related