Email Configuration (SES) on self hosted Redash EC2

Issue Summary

A summary of the issue and the browser/OS environment in which it occurs.

Technical details:

  • Redash Version: 8
  • Browser/OS: Chrome
    *Installed Redash using AMI available in AWS MarketPlace

I was trying to set up an email on self-hosted redash using SES.
after running the command (sudo docker-compose run --rm server manage send_test_mail) to test the email, I am getting the following error

Env file setup :

REDASH_MAIL_SERVER=“email-smtp.ap-south-1.amazonaws.com
REDASH_MAIL_PORT=25
REDASH_MAIL_USE_TLS=false
REDASH_MAIL_USE_SSL=false
REDASH_MAIL_USERNAME=“SES USERNAME”
REDASH_MAIL_PASSWORD=“SES PASSWORD”
REDASH_MAIL_DEFAULT_SENDER=“mymail”
REDASH_HOST=“http://ec2-x-y-z-w.ap-south-1.compute.amazonaws.com

Starting redash_redis_1 … done
Starting redash_postgres_1 … done
Traceback (most recent call last):
File “/app/manage.py”, line 9, in
manager()
File “/usr/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/flask/cli.py”, line 380, in main
return AppGroup.main(self, *args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/flask/cli.py”, line 257, in decorator
return __ctx.invoke(f, *args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/app/redash/cli/init.py”, line 72, in send_test_mail
body=“Test message.”))
File “/usr/local/lib/python2.7/site-packages/flask_mail.py”, line 491, in send
with self.connect() as connection:
File “/usr/local/lib/python2.7/site-packages/flask_mail.py”, line 144, in enter
self.host = self.configure_host()
File “/usr/local/lib/python2.7/site-packages/flask_mail.py”, line 158, in configure_host
host = smtplib.SMTP(self.mail.server, self.mail.port)
File “/usr/local/lib/python2.7/smtplib.py”, line 256, in init
(code, msg) = self.connect(host, port)
File “/usr/local/lib/python2.7/smtplib.py”, line 317, in connect
self.sock = self._get_socket(host, port, self.timeout)
File “/usr/local/lib/python2.7/smtplib.py”, line 292, in _get_socket
return socket.create_connection((host, port), timeout)
File “/usr/local/lib/python2.7/socket.py”, line 557, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

From the stack trace it looks like Redash can’t connect to your mail server.

  1. Double check your user, password, address, and port.
  2. Are any firewall rules blocking access?
  3. Do the email server logs show Redash connecting?