Catched errors don't sends mails notifications

I came from sentry github issues: https://github.com/getsentry/sentry/issues/3975#issuecomment-245463092 . tkaemming advise me to take help here.

I have problem with sentry: It seems to not send emails when error is catched in projects. However lost password mails, etc are sent and received.

tkaemming think about a configuration problem (about SMTP) concerning workers. But i don’t found specific configuration for workers.

There is my config:

config.yml:

mail.backend: 'smtp'  # Use dummy if you want to disable email entirely
mail.host: 'xxx'
mail.port: 587
mail.username: 'xxx'
mail.password: 'xxx'
mail.use-tls: false
mail.from: xxx'
system.secret-key: 'xxx'
redis.clusters:
  default:
    hosts:
      0:
        host: 127.0.0.1
        port: 6379

sentry.conf.py:

from sentry.conf.server import *
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
    'default': {
        'ENGINE': 'sentry.db.postgres',
        'NAME': 'sentry_db',
        'USER': 'sentry_user',
        'PASSWORD': 'sentry_password',
        'HOST': 'localhost',
        'PORT': '',
        'AUTOCOMMIT': True,
        'ATOMIC_REQUESTS': False,
    }
}
SENTRY_USE_BIG_INTS = True
SENTRY_SINGLE_ORGANIZATION = True
DEBUG = True
SENTRY_CACHE = 'sentry.cache.redis.RedisCache'
BROKER_URL = 'redis://localhost:6379'
SENTRY_RATELIMITER = 'sentry.ratelimits.redis.RedisRateLimiter'
SENTRY_BUFFER = 'sentry.buffer.redis.RedisBuffer'
SENTRY_QUOTAS = 'sentry.quotas.redis.RedisQuota'
SENTRY_TSDB = 'sentry.tsdb.redis.RedisTSDB'
SENTRY_DIGESTS = 'sentry.digests.backends.redis.RedisBackend'
SENTRY_FILESTORE = 'django.core.files.storage.FileSystemStorage'
SENTRY_FILESTORE_OPTIONS = {
    'location': '/tmp/sentry-files',
}
SENTRY_WEB_HOST = '0.0.0.0'
SENTRY_WEB_PORT = 9000
SENTRY_WEB_OPTIONS = {
    'protocol': 'uwsgi',
    'workers': 3
}

supervisor config:

[program:sentry-web]
directory=/srv/www/sentry.algoo.fr/
environment=SENTRY_CONF="/srv/www/sentry.algoo.fr"
command=/srv/www/sentry.algoo.fr/venv2.7/bin/sentry start
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/supervisor/sentry-web.log
stderr_logfile=/var/log/supervisor/sentry-web.log

[program:sentry-worker]
directory=/srv/www/sentry.algoo.fr/
environment=SENTRY_CONF="/srv/www/sentry.algoo.fr",C_FORCE_ROOT="true"
command=/srv/www/sentry.algoo.fr/venv2.7/bin/sentry run worker
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/supervisor/sentry-worker.log
stderr_logfile=/var/log/supervisor/sentry-worker.log

Do you see why these emails are not sent ?

Just found this in /var/log/supervisor/sentry-worker.log:

Traceback (most recent call last):
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/tasks/base.py", line 54, in _wrapped
    result = func(*args, **kwargs)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/tasks/digests.py", line 71, in deliver_digest
    plugin.notify_digest(project, digest)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/plugins/sentry_mail/models.py", line 221, in notify_digest
    return self.notify(notification)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/plugins/sentry_mail/models.py", line 202, in notify
    send_to=[user_id],
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/plugins/sentry_mail/models.py", line 87, in _send_mail
    return message.send_async()
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/utils/email.py", line 367, in send_async
    messages = self.get_built_messages(to, bcc=bcc)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/utils/email.py", line 346, in get_built_messages
    results = [self.build(to=email, reply_to=send_to, bcc=bcc) for email in send_to if email]
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/sentry/utils/email.py", line 320, in build
    'msgid': message_id,
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/models/manager.py", line 154, in get_or_create
    return self.get_queryset().get_or_create(**kwargs)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/models/query.py", line 391, in get_or_create
    six.reraise(*exc_info)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/models/query.py", line 383, in get_or_create
    obj.save(force_insert=True, using=self.db)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/transaction.py", line 316, in __exit__
    connection.commit()
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 171, in commit
    self._commit()
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 139, in _commit
    return self.connection.commit()
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/srv/www/sentry.algoo.fr/venv2.7/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 139, in _commit
    return self.connection.commit()
IntegrityError: insert or update on table "sentry_groupemailthread" violates foreign key constraint "group_id_refs_id_3c3dd283"
DETAIL:  Key (group_id)=(42) is not present in table "sentry_groupedmessage".

Seems related ! What can i do ?