---
title: "Send email from Django over SMTP"
description: "Django EMAIL_BACKEND pointed at Unitpost."
url: https://www.unitpost.com/guides/smtp/django
section: SMTP
updated: 2026-08-28
---
# Send email from Django over SMTP

## 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

## Send email from Django over SMTP

> Django EMAIL_BACKEND pointed at Unitpost.

Configure Django's built-in SMTP email backend to send through Unitpost. This is the same job as Nodemailer — Python instead of Node.

### 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

- [Send email with PHPMailer over SMTP](https://www.unitpost.com/guides/smtp/php): PHPMailer SMTP mode pointed at Unitpost.
- [Send email from Next.js over SMTP](https://www.unitpost.com/guides/smtp/nextjs): Nodemailer in an App Router Route Handler.
- [Send email from NestJS over SMTP](https://www.unitpost.com/guides/smtp/nestjs): Nodemailer inside a NestJS provider.
