Django
Learn how to integrate Reloop with Django to send emails.
Django Integration
Integrate Reloop into your Django application using the Python SDK.
Installation
pip install reloop-email
Setup settings.py
Add your API key to your settings:
# settings.py
import os
RELOOP_API_KEY = os.environ.get("RELOOP_API_KEY", "re_your_api_key_here")
Sending an Email
Use the client within your Django views:
from django.http import JsonResponse
from django.conf import settings
from reloop_email import Reloop
reloop = Reloop(api_key=settings.RELOOP_API_KEY)
def send_email_view(request):
if request.method == 'POST':
try:
result = reloop.mail.send({
"from": "onboarding@reloop.sh",
"to": "delivered@resend.dev",
"subject": "Hello from Django",
"html": "<p>Congrats on sending your first email via Reloop from Django!</p>",
})
if result.email_error:
raise result.email_error
return JsonResponse(result.response)
except Exception as e:
return JsonResponse({"error": str(e)}, status=500)Was this page helpful?
- Need help? Contact Support.
- Chat with Reloop developers on Discord.
- Check out our changelog.
- Questions? Contact Sales.
- LLM? Read llms.txt.