Couldn't receive email notification using SES in Glue script

0

I have added and verified my email in SES. However, when I use this service in Glue script, no email notification receives. Refer to screenshot.

Enter image description here

Below is my Glue script.

import boto3
from botocore.exceptions import ClientError

def send_email(subject, body, recipient):
    ses_client = boto3.client('ses', region_name='us-west-2')
    sender = 'rshah@astotek.com'

    message = {
        'Subject': {
            'Data': subject
        },
        'Body': {
            'Text': {
                'Data': body
            }
        }
    }

    try:
        response = ses_client.send_email(
            Source=sender,
            Destination={
                'ToAddresses': [recipient]
            },
            Message=message
        )
        print("Email sent! Message ID:", response['MessageId'])
    except ClientError as e:
        print("Error sending email:", e)

send_email("Test Subject", "Hello, this is a test email.", "rshah@astotek.com")

Nothing in my inbox or spam/junk folder. Is anything wrong with script or am I missing something? No error shows up.

preguntada hace 3 meses125 visualizaciones
1 Respuesta
0

You might have an error that you printing to the "Output" log, maybe don't catch it so you are immediately aware.
If the call works, there is no difference calling boto3 inside Glue on anywhere else.

When it doesn't error or finish as you say, it's very likely that the jobs runs inside a VPC and doesn't have access to the email endpoint.
If you wait long enough (10 minutes, it should timeout and tell you which url is trying to access).

profile pictureAWS
EXPERTO
respondido hace 3 meses
  • The problem is, the job runs infinitely and doesn't print any log. I had to stop the job. What could be problem?

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas