Help with setting up email alerts

1,335 views
Skip to first unread message

Elik Rozenboim

unread,
Nov 2, 2015, 6:40:11 AM11/2/15
to re:dash users
I've defined some test alerts and they triggered successfully, but I haven't received an email from re:dash.

Do I need to setup some smtp server for re:dash?

Arik Fraimovich

unread,
Nov 3, 2015, 3:00:10 AM11/3/15
to Elik Rozenboim, re:dash users
Yes, you need to configure the SMTP server, see these settings: https://github.com/EverythingMe/redash/blob/master/redash/settings.py#L94-L105

If you don't use any service to send emails, you can sign up with MailGun. They have a free tier that should be enough for re:dash needs.

-- 
Arik Fraimovich

On Mon, Nov 2, 2015 at 1:40 PM, Elik Rozenboim <elik.ro...@joytunes.com> wrote:
I've defined some test alerts and they triggered successfully, but I haven't received an email from re:dash.

Do I need to setup some smtp server for re:dash?

--
You received this message because you are subscribed to the Google Groups "re:dash users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redash-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Elik Rozenboim

unread,
Nov 3, 2015, 7:42:15 AM11/3/15
to re:dash users, elik.ro...@joytunes.com, ar...@arikfr.com
Thanks!

I've added the following params to the .env file:

REDASH_MAIL_SERVER

REDASH_MAIL_USERNAME

REDASH_MAIL_PASSWORD


restarted the server, restarted the celery workers - but I still didn't receive an email... What am I missing?

Arik Fraimovich

unread,
Nov 3, 2015, 7:50:40 AM11/3/15
to Elik Rozenboim, re:dash users
I suggest you also set the default sender (that's the from address) and host (this is the path to your redash instance).

To verify settings, try running: bin/run ./manage.py send_test_mail from /opt/redash/current.

-- 
Arik Fraimovich

Elik Rozenboim

unread,
Nov 3, 2015, 9:33:02 AM11/3/15
to re:dash users, elik.ro...@joytunes.com, ar...@arikfr.com
I'm getting the following error:
Traceback (most recent call last):

 

  File "./current/manage.py", line 58, in <module>

    manager.run()

  File "/usr/local/lib/python2.7/dist-packages/flask_script/__init__.py", line 405, in run

    result = self.handle(sys.argv[0], sys.argv[1:])

  File "/usr/local/lib/python2.7/dist-packages/flask_script/__init__.py", line 384, in handle

    return handle(app, *positional_args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/flask_script/commands.py", line 145, in handle

    return self.run(*args, **kwargs)

  File "./current/manage.py", line 54, in send_test_mail

    mail.send(Message(subject="Test Message from re:dash", recipients=[settings.MAIL_DEFAULT_SENDER], body="Test message."))

  File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 491, in send

    with self.connect() as connection:

  File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 144, in __enter__

    self.host = self.configure_host()

  File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 158, in configure_host

    host = smtplib.SMTP(self.mail.server, self.mail.port)

  File "/usr/lib/python2.7/smtplib.py", line 256, in __init__

    (code, msg) = self.connect(host, port)

  File "/usr/lib/python2.7/smtplib.py", line 316, in connect

    self.sock = self._get_socket(host, port, self.timeout)

  File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket

    return socket.create_connection((host, port), timeout)

  File "/usr/lib/python2.7/socket.py", line 571, in create_connection

    raise err

socket.error: [Errno 111] Connection refused



The problem is coming from re:dash not reading the new values in the .env file despite the fact that I restarted the server and celery workers. 
When I export the variables from the command line, I manage to successfully use the send_test_mail option.

Arik Fraimovich

unread,
Nov 3, 2015, 4:24:08 PM11/3/15
to Elik Rozenboim, re:dash users
When running the test command are you prefixing it with "bin/run"?

-- 
Arik Fraimovich

Elik Rozenboim

unread,
Nov 4, 2015, 6:49:21 AM11/4/15
to re:dash users, elik.ro...@joytunes.com, ar...@arikfr.com
Found the problem!

There were errors in the .env file, that's why it wasn't read properly. 

Thanks so much for your help and suggestions! We now have functioning email alerts!

John Connell

unread,
Dec 29, 2015, 8:49:24 PM12/29/15
to re:dash users, elik.ro...@joytunes.com, ar...@arikfr.com
I'm having an issue similar to Elik's. I would like to know what you changed in your .env if you don't mind Elik.

I'm using 0.8.3 on a Google Cloud Compute instance. Everything is working great except email. I'm using mailgun and have verified that all of the details are correct.

bin/run ./manage.py send_test_mail
[2015-12-30 01:33:35,978][PID:2567][WARNING][redash.query_runner] MQL query runner enabled but not supported, no
t registering
. Either disable or install missing dependencies.
[2015-12-30 01:33:36,029][PID:2567][WARNING][redash.query_runner] Oracle query runner enabled but not supported,
 
not registering. Either disable or install missing dependencies.

Traceback (most recent call last):

 
File "/opt/redash/current/manage.py", line 58, in <module>

    manager
.run()
 
File "/usr/local/lib/python2.7/dist-packages/flask_script/__init__.py", line 405, in run
    result
= self.handle(sys.argv[0], sys.argv[1:])
 
File "/usr/local/lib/python2.7/dist-packages/flask_script/__init__.py", line 384, in handle
   
return handle(app, *positional_args, **kwargs)
 
File "/usr/local/lib/python2.7/dist-packages/flask_script/commands.py", line 145, in handle
   
return self.run(*args, **kwargs)

 
File "/opt/redash/current/manage.py", line 54, in send_test_mail
    mail
.send(Message(subject="Test Message from re:dash", recipients=[settings.MAIL_DEFAULT_SENDER], body="Test
 message."
))

 
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 491, in send
   
with self.connect() as connection:
 
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 144, in __enter__
   
self.host = self.configure_host()
 
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 158, in configure_host
    host
= smtplib.SMTP(self.mail.server, self.mail.port)
 
File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
   
(code, msg) = self.connect(host, port)
 
File "/usr/lib/python2.7/smtplib.py", line 316, in connect
   
self.sock = self._get_socket(host, port, self.timeout)
 
File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
   
return socket.create_connection((host, port), timeout)
 
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
   
raise
err
socket
.error: [Errno 110] Connection timed out

export REDASH_MAIL_SERVER="smtp.mailgun.org"
export REDASH_MAIL_PORT="587"
export REDASH_MAIL_USE_TLS="true"
export REDASH_MAIL_USE_SSL="false"
export REDASH_MAIL_USERNAME="postmaster@_____.com" #Domain redacted
export REDASH_MAIL_PASSWORD="" #PW redacted
export REDASH_MAIL_DEFAULT_SENDER="postmaster@_____.com" #Domain redacted
export REDASH_HOST="http://_____.com" #Domain redacted

Any help would be greatly appreciated.

Thanks!

Arik Fraimovich

unread,
Dec 30, 2015, 12:06:47 AM12/30/15
to John Connell, re:dash users, elik.ro...@joytunes.com

Google blocks connections to standard smtp ports. Mailgun listen on port 2525 as well for this reason. Can you try that? Because other than that your settings look correct.

John Connell

unread,
Dec 30, 2015, 12:21:36 PM12/30/15
to re:dash users, jo...@cogitatemedia.com, elik.ro...@joytunes.com, ar...@arikfr.com
Port 2525 works great. Thanks so much Arik!
Reply all
Reply to author
Forward
0 new messages