Skip to main content

Prerequisites

To get the most out of this guide, you’ll need to:
You can find your API keys in your SendPost Dashboard. Make sure to use your Sub-Account API Key for sending emails.

1. Install Dependencies

pip

2. Environment Setup

Add to your settings.py:
Python
Create a .env file:

3. Create Email Service

Create services/email_service.py:
Python

4. Send Your First Email

In a View

Create views.py:
Python
Add to urls.py:
Python

5. Common Use Cases

Welcome Email

Create views/welcome_email.py:
Python

Password Reset Email

Create views/password_reset_email.py:
Python

Order Confirmation Email

Create views/order_confirmation_email.py:
Python

6. Using Django Signals

Create signals.py:
Python
Register signals in apps.py:
Python

7. Using Celery for Async Email Sending

Create tasks.py:
Python
Use in views:
Python

8. Custom Email Backend (Optional)

Create backends/sendpost_backend.py:
Python
Add to settings.py:
Python
Make sure your sender email domain is verified in your SendPost account before sending emails.

9. Next Steps

Explore more examples and use cases:

Django Documentation

Learn more about Django framework

SendPost Python SDK

View the official SDK package on PyPI

Quickstart Example

View a complete working example on GitHub