Skip to content

Setting up email in development

Cam Saul edited this page Sep 16, 2021 · 6 revisions

If you need to work on or test a feature that requires email set up, and you don't actually care about email delivery, the easiest way is to run a simple email server locally.

To start up a server run the following command in a new terminal window.

# Note this assumes you have a working Python installation.
# These commands should work out of the box on Mac OSX

# If you don't care about the port (most folks)
python -m smtpd -n -c DebuggingServer localhost:1025

# If you want it to be bound to port 25 then you need to do so as root
sudo python -m smtpd -n -c DebuggingServer localhost:25

# If you run the smtpd server in a separate docker/docker-compose,
# change localhost to 0.0.0.0 to not filter requests by host name

Then, if you navigate to http://localhost:3000/admin/settings/email you can enter the following info

  • SMTP host: localhost
  • Port: 1025 (or 25 if you took the sudo route)
  • Security: None
  • Username: Leave blank
  • Password: Leave blank
  • From address: test@local.host (or whatever you want)

Emails sent from Metabase will now appear in the console where you ran the command.

Option 2

You can clone https://github.com/metabase/dev-scripts and use the ./run-smtp.sh script. This script runs a Docker image that provides a web interface to view any emails you send via the SMTP server. The benefit of this script over the Python one mentioned above is that HTML emails render in your browser so you can see how the messages look when formatted. The Python script above just dumps raw text into the console.

Clone this wiki locally