Django
Configure Django's built-in SMTP backend to send through Unitpost.
What are the SMTP 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 |
How do I set it up?
Configure your settings
Add the SMTP settings to
settings.py. Keep the API key in an environment variable.PythonEMAIL_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"Send an email
Use
send_mailor anEmailMessage. The from address must be on a verified domain.Pythonfrom 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>", )Verify delivery
Check your Unitpost Activity view for the message and its status.