Issue Summary

When I added a New User in Redash,
it didn’t send email form redash with Amazon SES.
Is there something missing in env?

Technical details:

  • Redash Version: 10.0.0.b50363
  • Browser/OS: Ubuntu 20.04.1 LTS
  • How did you install Redash:
# mkdir /opt/redash/
# cd /opt
# git clone https://github.com/getredash/setup.git
# cd setup
# sh setup.sh
. . .
# vim /opt/redash/docker-compose.yml
change :
 --------------------------------------------------
 image: redash/redash:10.0.0.b50363
 --------------------------------------------------

# vim /opt/redash/env
add :
--------------------------------------------------
REDASH_MAIL_SERVER=email-smtp.xxxxxxxxxxxxxx
REDASH_MAIL_PORT=25 (or 465, 587)
REDASH_MAIL_USE_TLS=false (or true)
REDASH_MAIL_USE_SSL=false (or ture)
REDASH_MAIL_USERNAME=xxxxxxxxxxx (AWS creds smtp username)
REDASH_MAIL_PASSWORD=xxxxxxxxxxx (AWS creds smtp password)
REDASH_MAIL_DEFAULT_SENDER=myname1@mydomain1
--------------------------------------------------

# cd /opt/redash
# docker-compose down && docker-compose up -d

Amazon SES

Verify a New Email Address > Verified
Send a Test Email

--------------------------------------------------
From : myname1@mydomain1
To : myname1@mydomain1
--------------------------------------------------
> OK (sent)

Create My SMTP Credentials > OK (done)

Redash

Logged in Redash (http://192.168.x.x/login)
Settings > Users > +New User

Name : hoge
Email : myname1@mydomain1

Create > [(v) Saved.]

comment

I haven’t received the email. There are no particular error messages in Redash. Is there a log file somewhere?

1 Like

I’m away from my workstation. But FYI The setup script has not been updated to for V10 yet. I don’t think that would be the issue but it’s possible.

Rather than editing the env file within the container, try making those changes in the setup script itself and re-running.

thank you.
I will try redash v8. and edit setup.sh.

Looking into this further I think there may be a compatibility issue specifically between Redash and SES. Investigating…

I am encountering this as well. Running manage.py send_test_email works, but sending an email from UI fails. An error message can be obtained with manage.py users invite $email_to_invite $username $send_from_email, which will return:
RuntimeError: Application was not able to create a URL adapter for request independent URL generation. You might be able to fix this by setting the SERVER_NAME config variable.

However, setting SERVER_NAME or REDASH_SERVER_NAME does not have an impact. The same issue is reported on 8.x here: Invitation etc emails not being sent on the account of the code failing to generate urls · Issue #5266 · getredash/redash · GitHub. That solution did not work for v10.

2 Likes

Hi, thank you for everyone.

I tried inviting new user with Redash v8. It worked completry.

But after update to v10, it does not work.
Even if I added “SERVER_NAME or REDASH_SERVER_NAME”.

# docker-compose run --rm server manage send_test_mail
Starting redash_postgres_1 ... done
Starting redash_redis_1    ... done
(OK)

・・・
# docker-compose run --rm server manage users invite myname1@mydomain1 hoge myname1@mydomain1
Starting redash_postgres_1 ... done
Starting redash_redis_1    ... done
The inviter [myname1@mydomain1] was not found.

I will use v8 for a while.
I will search for the manual(documents) to update for v10.

1 Like

I successfully configured Amazon SES with an V8 AMI that I upgraded to V10 in EC2. It didn’t require anything fancy. Here were my settings in /opt/redash/env

I did not test the CLI functions. I just reproduced that users would receive invitations triggered in the web app, reset password emails went normally, and alerts worked as expected.

1 Like

I haven’t sent an email with the combination of redash v10 and amazon ses yet.

What I did.
・Email authentication.
email_verify_2021-12-07 135702

env

## email
REDASH_SERVER_NAME=https://****.mydomain.com
REDASH_MAIL_SERVER=email-smtp.ap-northeast-1.amazonaws.com
REDASH_MAIL_PORT=587
REDASH_MAIL_USE_TLS=true
# REDASH_MAIL_PORT=465
# REDASH_MAIL_USE_SSL=true
REDASH_MAIL_USERNAME=AKIA***
REDASH_MAIL_PASSWORD=****
REDASH_MAIL_DEFAULT_SENDER=xxx@mydomain.com

Logs.

redash-nginx-1             | 172.28.0.1 - - [07/Dec/2021:06:47:06 +0000] "GET /api/users?order=-created_at&page=1&page_size=20&pending=true HTTP/1.0" 200 1994 "https://***.mydomain.com/users/pending?order=-created_at&page=1&page_size=20" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36" "ipaddress"
redash-scheduler-1         | [2021-12-07 15:47:09,871][PID:1][DEBUG][rq_scheduler.scheduler] Entering run loop
redash-scheduler-1         | [2021-12-07 15:47:09,872][PID:1][DEBUG][rq_scheduler.scheduler] Checking for scheduled jobs
redash-scheduler-1         | [2021-12-07 15:47:09,872][PID:1][DEBUG][rq_scheduler.scheduler] Sleeping 5.00 seconds
redash-scheduler-1         | [2021-12-07 15:47:14,876][PID:1][DEBUG][rq_scheduler.scheduler] Entering run loop
redash-scheduler-1         | [2021-12-07 15:47:14,877][PID:1][DEBUG][rq_scheduler.scheduler] Checking for scheduled jobs
redash-scheduler-1         | [2021-12-07 15:47:14,879][PID:1][DEBUG][rq_scheduler.scheduler] Sleeping 5.00 seconds
redash-scheduler-1         | [2021-12-07 15:47:19,882][PID:1][DEBUG][rq_scheduler.scheduler] Entering run loop
redash-scheduler-1         | [2021-12-07 15:47:19,882][PID:1][DEBUG][rq_scheduler.scheduler] Checking for scheduled jobs
redash-scheduler-1         | [2021-12-07 15:47:19,883][PID:1][DEBUG][rq_scheduler.scheduler] Pushing 17dcw25bf3586a6a629110d27f788b05c0700233 to periodic
redash-scheduler-1         | [2021-12-07 15:47:19,885][PID:1][DEBUG][rq_scheduler.scheduler] Pushing 18281a8657dcw25ef3586a6a62ed3d1a60f7dcw4 to periodic
redash-scheduler-1         | [2021-12-07 15:47:19,886][PID:1][DEBUG][rq_scheduler.scheduler] Pushing 305c0cae0a196ae96915fd2b6f81001c435aad65 to periodic
redash-scheduler-1         | [2021-12-07 15:47:19,888][PID:1][DEBUG][rq_scheduler.scheduler] Pushing 59a84668e46f3386c5335565213686878e814b72 to periodic
redash-scheduler-1         | [2021-12-07 15:47:19,889][PID:1][DEBUG][rq_scheduler.scheduler] Pushing e527c427209009c17c575fc7d0957cb21756e661 to periodic
redash-scheduler-1         | [2021-12-07 15:47:19,890][PID:1][DEBUG][rq_scheduler.scheduler] Sleeping 4.99 seconds
redash-redis-1             | 1:M 07 Dec 2021 06:47:20.079 * 100 changes in 300 seconds. Saving...
redash-redis-1             | 1:M 07 Dec 2021 06:47:20.079 * Background saving started by pid 23
redash-redis-1             | 23:C 07 Dec 2021 06:47:20.085 * DB saved on disk
redash-redis-1             | 23:C 07 Dec 2021 06:47:20.085 * RDB: 0 MB of memory used by copy-on-write
redash-redis-1             | 1:M 07 Dec 2021 06:47:20.179 * Background saving terminated with success
redash-scheduler-1         | [2021-12-07 15:47:24,884][PID:1][DEBUG][rq_scheduler.scheduler] Entering run loop
redash-scheduler-1         | [2021-12-07 15:47:24,885][PID:1][DEBUG][rq_scheduler.scheduler] Checking for scheduled jobs
redash-scheduler-1         | [2021-12-07 15:47:24,886][PID:1][DEBUG][rq_scheduler.scheduler] Sleeping 5.00 seconds
redash-scheduler-1         | [2021-12-07 15:47:29,890][PID:1][DEBUG][rq_scheduler.scheduler] Entering run loop
redash-scheduler-1         | [2021-12-07 15:47:29,890][PID:1][DEBUG][rq_scheduler.scheduler] Checking for scheduled jobs
redash-scheduler-1         | [2021-12-07 15:47:29,891][PID:1][DEBUG][rq_scheduler.scheduler] Sleeping 5.00 seconds
redash-scheduler-1         | [2021-12-07 15:47:34,895][PID:1][DEBUG][rq_scheduler.scheduler] Entering run loop

Is the organization name relevant?

(./manage.py org list)
Id: 1
Name: mydomain
Slug: default

The organisation name is irrelevant unless you enabled multi-org (which is off by default).

Your logs don’t show any failures. Which means Redash thinks the email has gone out successfully (and SES did not return any exceptions).

Have you verified that your sending address is no longer sandboxed with SES?

Thank you reply.
Production Access is Enabled.

I was able to send an email to Gmail.

and it was possible to send with version 8.

Have you tried setting REDASH_MAIL_USE_SSL=true and REDASH_MAIL_PORT=465?

Restart your services after making these changes to ensure they take effect.

REDASH_MAIL_USE_SSL=true
REDASH_MAIL_PORT=465

Yes, I tried it.

Restart your services

Yes, I did.

I am trying various things. I will add comments here when I understand something.

1 Like

@jesse - I tried your recommended settings of:

REDASH_MAIL_USE_SSL=true
REDASH_MAIL_PORT=465

This resulted in the same error when inviting a user:

  File "/usr/local/lib/python3.7/site-packages/flask/helpers.py", line 333, in url_for
    "Application was not able to create a URL adapter for request"
RuntimeError: Application was not able to create a URL adapter for request independent URL generation. You might be able to fix this by setting the SERVER_NAME config variable.

Unlike using port 587 and TLS, send-test-email also returns an error:

  File "/app/redash/cli/__init__.py", line 73, in send_test_mail
    subject="Test Message from Redash", recipients=[email], body="Test message."
  File "/usr/local/lib/python3.7/site-packages/flask_mail.py", line 491, in send
    with self.connect() as connection:
  File "/usr/local/lib/python3.7/site-packages/flask_mail.py", line 144, in __enter__
    self.host = self.configure_host()
  File "/usr/local/lib/python3.7/site-packages/flask_mail.py", line 163, in configure_host
    host.starttls()
  File "/usr/local/lib/python3.7/smtplib.py", line 757, in starttls
    "STARTTLS extension not supported by server.")
smtplib.SMTPNotSupportedError: STARTTLS extension not supported by server.

I found the solution in a Github issue: Email invite doesn't send after update Redash to v10 · Issue #5640 · getredash/redash · GitHub

You need to assign the emails queue to a worker in docker-compose.yml.

# Old
  adhoc_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "queries"
      WORKERS_COUNT: 2
# New
  adhoc_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "emails,queries,default,periodic"
      WORKERS_COUNT: 2

This fixes emails from the front end, the CLI users invite still returns the error, but this solves the issue for me.

2 Likes

Thanks for posting your solution. We’ll update the docs for this ASAP. Also the CLI is definitely broken.

1 Like