I am not able to send the Emails using Amazon SES

I am using K8s to run redash server and worker.
The followings are the summary of the task definition for worker container

  • image: ‘redash/redash:‘9.0.0-beta.b42121’
  • command: ‘worker’
  • environment variables
    • REDASH_HOST: ‘https://xxxx.com’ // url to my redash service
    • REDASH_REDIS_URL: redisUrl,
    • REDASH_DATABASE_URL: dbUrl,
    • REDASH_COOKIE_SECRET: ‘my-secret’,
    • QUEUES: ‘default,queries,scheduled_queries,schemas,emails,periodic’,
    • WORKERS_COUNT: ‘4’,
    • REDASH_MAIL_SERVER: ‘email-smtp.ap-south-1.amazonaws.com’,
    • REDASH_MAIL_PORT: ‘465’,
    • REDASH_MAIL_USERNAME: ‘XXXXXXXXX’, // access key of SES smtp credential
    • REDASH_MAIL_PASSWORD: ‘xxxxxxxxxxxx’, // secret access key of SES smtp credential
    • REDASH_MAIL_DEFAULT_SENDER: ‘xxxxx@mydomain.com’,
    • REDASH_MAIL_USE_TLS: ‘true’

I have added xxxxx@mydomain.com to AWS SES verified identities.

Could you please tell me how to set up correctly?

Thank you in advance.

Logs:

[2022-06-17 13:27:05,332][PID:15][INFO][rq.worker] emails: c53cd12a-21d4-4bc5-99ef-2ff55c2fc3ef
[2022-06-17 13:27:40,728][PID:87][ERROR][rq.job.redash.tasks.general] job.func_name=redash.tasks.general.send_mail job.id=c53cd12a-21d4-4bc5-99ef-2ff55c2fc3ef Failed sending message: Ujala Singh invited you to join Redash
Traceback (most recent call last):
  File "/app/redash/tasks/general.py", line 63, in send_mail
    mail.send(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 158, in configure_host
    host = smtplib.SMTP(self.mail.server, self.mail.port)
  File "/usr/local/lib/python3.7/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.7/smtplib.py", line 338, in connect
    (code, msg) = self.getreply()
  File "/usr/local/lib/python3.7/smtplib.py", line 394, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
[2022-06-17 13:27:40,731][PID:87][INFO][rq.worker] emails: Job OK (c53cd12a-21d4-4bc5-99ef-2ff55c2fc3ef)
[2022-06-17 13:27:40,731][PID:87][INFO][rq.worker] Result is kept for 500 seconds
2022/06/17 13:28:01 [worker_healthcheck] Received TICK_60 event from supervisor
2022/06/17 13:28:01 [worker_healthcheck] Performing `RQ Worker Healthcheck` check for process name worker-0
2022/06/17 13:28:01 [worker_healthcheck] Performing `RQ Worker Healthcheck` check for process name worker-1
2022/06/17 13:28:01 [worker_healthcheck] `RQ Worker Healthcheck` check succeeded for process worker-0
2022/06/17 13:28:01 [worker_healthcheck] `RQ Worker Healthcheck` check succeeded for process worker-1
2022/06/17 13:28:01 [worker_healthcheck] Performing `RQ Worker Healthcheck` check for process name worker-3
2022/06/17 13:28:01 [worker_healthcheck] Performing `RQ Worker Healthcheck` check for process name worker-2
2022/06/17 13:28:01 [worker_healthcheck] `RQ Worker Healthcheck` check succeeded for process worker-3
2022/06/17 13:28:01 [worker_healthcheck] `RQ Worker Healthcheck` check succeeded for process worker-2
RESULT 2
OKREADY

This is resolved. Port is actually 587. Also you have to move your account out of the Amazon SES sandbox.

1 Like