python
# settings.py
CELERY_BROKER_URL = 'amqp://guest@localhost//'
CELERY_RESULT_BACKEND = 'amqp://guest@localhost//'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']
shell
$ pip install django-celery-ses
python
# views.py
from django_ses import send_email
def send_contact_email(request):
sender = request.POST.get('sender', '')
recipient = request.POST.get('recipient', '')
subject = request.POST.get('subject', '')
message = request.POST.get('message', '')
send_email(
source=sender,
subject=subject,
message=message,
recipients=[recipient],
fail_silently=False
)
return HttpResponse('Email sent successfully')