Skip to main content

Django emails in a local inbox, not the console

Switch the Django email backend from console to SMTP and point it at Buggregator: host 127.0.0.1, port 1025. Every email your Django app sends then shows up in the Buggregator UI with the rendered HTML, headers and attachments, and nothing is delivered.

Steps

1. Start Buggregator

Run the container. Port 8000 is the web UI, port 1025 is the SMTP server.

bash
docker run --pull always \
  -p 127.0.0.1:8000:8000 \
  -p 127.0.0.1:1025:1025 \
  -p 127.0.0.1:9912:9912 \
  -p 127.0.0.1:9913:9913 \
  ghcr.io/buggregator/server:latest

2. Django 6.1 and newer: set the default mailer

Django 6.1 configures email with the MAILERS setting. Projects created with startproject get the console backend as the default mailer, which prints email to the console. Use the SMTP backend instead. This is Django's own example:

python
MAILERS = {
    "default": {
        "BACKEND": "django.core.mail.backends.smtp.EmailBackend",
        "OPTIONS": {
            "host": "localhost",
        },
    },
}

Set "host" to "127.0.0.1" and add "port": 1025 under OPTIONS. Without a port, the SMTP backend uses 25.

3. Without MAILERS: set EMAIL_HOST and EMAIL_PORT

Without MAILERS, Django uses EMAIL_BACKEND, and its default is django.core.mail.backends.smtp.EmailBackend. If you set the console backend for development, remove that line or set it back to the SMTP backend. Then set EMAIL_HOST = '127.0.0.1' and EMAIL_PORT = 1025. Django 6.1 marks these EMAIL_* settings as deprecated, so move to MAILERS when you upgrade.

4. Send an email and open it

Send mail from your app as usual. Open http://127.0.0.1:8000 and check the HTML preview, the plain text version, the addresses, the attachments and the raw MIME source. In Docker Compose, use the Buggregator service name, for example buggregator, instead of 127.0.0.1.

Why it works

Django's SMTP backend talks plain SMTP to whatever host and port you give it. Buggregator listens on port 1025, needs no authentication, and stores each email for the UI instead of delivering it.

Sources: Django settings reference and sending email.

Checked on with Buggregator v2.8.0

Setup in 60 seconds

No registration. No account. Start it and point your app at it.

1

Start Buggregator

One file, installed with one command. The web UI opens on port 8000. Prefer containers? Use the Docker tab.

$ curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
$ HTTP_ADDR=127.0.0.1:8000 \
  SMTP_ADDR=127.0.0.1:1025 \
  VAR_DUMPER_ADDR=127.0.0.1:9912 \
  MONOLOG_ADDR=127.0.0.1:9913 \
  PROXY_ADDR=127.0.0.1:8080 \
  ~/.local/bin/buggregator

The script picks the file for your CPU: Intel/AMD or ARM.

One file for Linux, macOS and Windows, about 40 MB. Nothing else to install.

This run line keeps it on this computer. Without the *_ADDR settings it listens on all network interfaces →

Rather not run a script? Download the file yourself →

Runs on Windows, macOS and Linux, on Intel/AMD and ARM.

Prefer not to do it yourself? Your AI agent can set Buggregator up for you →