Django & Python

Django's SMTP backend works with Signally unchanged. For other Python apps, call the REST API with requests or use smtplib.

Django over SMTP

Hostsmtp.signally.cloud
Port465 with SSL/TLS (recommended), or 587 with STARTTLS
UsernameYour SMTP username, e.g. smtp-12-ab3xk9
PasswordThe SMTP password shown once when you created the login

Create an SMTP login under API & SMTP in your dashboard. It is separate from your API keys. The From address must be on a domain you have verified.

settings.py
import os

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.signally.cloud"
EMAIL_PORT = 465
EMAIL_USE_SSL = True          # for port 587 use EMAIL_USE_TLS = True instead
EMAIL_HOST_USER = os.environ["SIGNALLY_SMTP_USER"]
EMAIL_HOST_PASSWORD = os.environ["SIGNALLY_SMTP_PASS"]
EMAIL_TIMEOUT = 30
DEFAULT_FROM_EMAIL = "Your Shop <[email protected]>"
SERVER_EMAIL = "[email protected]"   # Django error emails

Set only one of EMAIL_USE_SSL and EMAIL_USE_TLS. Then test from the shell:

Terminal
python manage.py shell
>>> from django.core.mail import send_mail
>>> send_mail("Test", "Hello from Signally", None, ["[email protected]"])
1

Password resets, send_mail, EmailMultiAlternatives and admin error emails all go through Signally. Every From address must be on a domain you have verified.

Python REST API

signally.py
import os
import requests

session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['SIGNALLY_API_KEY']}"

def send_email(to, subject, html, idempotency_key=None):
    headers = {"Idempotency-Key": idempotency_key} if idempotency_key else {}
    r = session.post(
        "https://api.signally.cloud/v1/email",
        json={
            "from": {"address": "[email protected]", "name": "Your Shop"},
            "to": [to] if isinstance(to, str) else to,
            "subject": subject,
            "html": html,
        },
        headers=headers,
        timeout=30,
    )
    if r.status_code >= 400:
        err = r.json()["error"]
        raise RuntimeError(f"{err['code']}: {err['message']}")
    return r.json()  # {"message_id": ..., "accepted": 1, "suppressed": []}

send_email("[email protected]", "Your receipt", "<p>Paid: KES 2,400</p>",
           idempotency_key="receipt-INV-1042")

Python smtplib

Python
import os, smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["From"] = "Your Shop <[email protected]>"
msg["To"] = "[email protected]"
msg["Subject"] = "Your order has shipped"
msg.set_content("It is on its way!")
msg.add_alternative("<p>It is on its way!</p>", subtype="html")

with smtplib.SMTP_SSL("smtp.signally.cloud", 465, timeout=30) as s:
    s.login(os.environ["SIGNALLY_SMTP_USER"], os.environ["SIGNALLY_SMTP_PASS"])
    s.send_message(msg)

Keep keys and passwords in environment variables or your secrets manager, never in your code or Git repository. If one leaks, revoke it under API & SMTP and create a new one.

Stuck? Email [email protected] with your account name and the message ID or error code.