Send email
with Django
Point Django’s email backend at Plunk and send_mail, password resets and every other built-in email go through it.
POST/v1/send
200 OK- To
- ana@acme.com
- From
- Acme <hello@acme.com>
- Subject
- Reset your password
Reset your password
To ana@acme.com
- Sent09:41:02
- Delivered09:41:03
- Opened09:42:18
Before you send
Create a project
Sign up for free and copy your secret key from the project settings.
Verify your domain
Add the DNS records Plunk shows you. It checks them and tells you when you can send.
Send
Use the API or your framework’s mailer, below. Every email shows up in the dashboard.
Send with Django over SMTP
Set the SMTP backend in settings. Django’s own emails, like password resets, use it with no other changes.
settings.py
import os
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.useplunk.com"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "plunk"
EMAIL_HOST_PASSWORD = os.environ["PLUNK_SECRET_KEY"]
DEFAULT_FROM_EMAIL = "Acme <hello@acme.com>"
# Anywhere in your app:
# from django.core.mail import send_mail
# send_mail("Welcome to Acme", "Thanks for signing up.", None, ["ana@acme.com"])Send with the API
Use the API when you want Plunk templates or want the send to start a workflow.
emails.py
import os
import requests
response = requests.post(
"https://send-api.akmarketingseo.com/v1/send",
headers={"Authorization": f"Bearer {os.environ['PLUNK_SECRET_KEY']}"},
json={
"to": "ana@acme.com",
"subject": "Welcome to Acme",
"body": "<p>Thanks for signing up.</p>",
},
timeout=10,
)
response.raise_for_status()Frequently asked questions
Send your first email from Django.
Start on the free plan with 1,000 emails a month, no credit card needed. When you need more, every email is $0.001, with unlimited contacts and every feature included.