---
title: "Django"
description: "Use Django's SMTP email backend with Unitpost."
url: https://www.unitpost.com/guides/smtp/django
section: SMTP
updated: 2026-07-24
---
# Django

## Connection settings

- **Host**: smtp.unitpost.com
- **Username**: unitpost (always this literal value)
- **Password**: Your Unitpost API key (must carry emails:send)
- **Port (STARTTLS)**: 587 (or 2587 if blocked)
- **Port (implicit TLS)**: 465 (or 2465 if blocked)
- **From address**: Any address on a verified domain

## Django

> Use Django's SMTP email backend with Unitpost.

Configure Django's built-in SMTP backend to send through Unitpost.

### 1. Configure your settings

Add the SMTP settings to `settings.py`. Keep the API key in an environment variable.

```python
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.unitpost.com"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "unitpost"
EMAIL_HOST_PASSWORD = os.environ["UNITPOST_API_KEY"]
DEFAULT_FROM_EMAIL = "you@yourdomain.com"
```

### 2. Send an email

Use `send_mail` or an `EmailMessage`. The from address must be on a verified domain.

```python
from django.core.mail import send_mail

send_mail(
    subject="Hello from Unitpost",
    message="Sent via SMTP.",
    from_email="you@yourdomain.com",
    recipient_list=["customer@example.com"],
    html_message="<h1>Welcome!</h1>",
)
```

### 3. Verify delivery

Check your Unitpost Activity view for the message and its status.

## Related

- [PHPMailer](https://www.unitpost.com/guides/smtp/php): Send from any PHP app using the PHPMailer library.
- [Nodemailer](https://www.unitpost.com/guides/smtp/nodemailer): Send from any Node.js app with the most popular SMTP client.
- [Supabase Auth](https://www.unitpost.com/guides/smtp/supabase): Deliver Supabase auth emails (magic links, confirmations) via Unitpost.
