Код: Выделить всё
EMAIL_BACKEND = 'django_amazon_ses.EmailBackend'
AWS_SES_REGION = env('AWS_SES_REGION')
AWS_SES_SENDER_MAIL = env('AWS_SES_SENDER_MAIL')
AWS_SES_SENDER = env('AWS_SES_SENDER')
AWS_ACCESS_KEY = env('AWS_ACCESS_KEY')
AWS_KEY_ID = env('AWS_KEY_ID')
Код: Выделить всё
try:
subject = f"Registration Confirmation for {event.title}"
message = f"""
Hello {request.user.username},
You have successfully registered for the event: {event.title}
Event Details:
Date: {event.date}
Location: {event.location}
Description: {event.description}
Thank you for joining!
"""
send_mail(
subject,
message,
settings.AWS_SES_SENDER_MAIL,
[request.user.email],
fail_silently=False
)
return Response({
'message': 'Event joined and email sent.',
'email_status': 'sent'
}, status=status.HTTP_200_OK)
except Exception as e:
return Response({
'message': 'Event joined but email could not be sent.',
'email_error': str(e)
}, status=status.HTTP_200_OK)
else:
return Response({'error': 'Event member limit reached. Cannot join.'},
status=status.HTTP_406_NOT_ACCEPTABLE)
Я получаю HTTP 200, хотя в коде нет проблем, мой адрес электронной почты не доставлено, но я не получаю никаких ошибок. Может кто-нибудь помочь?
Подробнее здесь: https://stackoverflow.com/questions/791 ... ith-python