I have installed a Sentry instance on my server, and I want to configure it to send alert emails using Mandrill and its Django integration djrill. Here's the relevant settings in the sentry.conf.py
file I'm using:
EXTRA_INSTALLED_APPS = (
'djrill',
)
EMAIL_BACKEND = 'djrill.mail.backends.djrill.DjrillBackend'
MANDRILL_API_KEY = '[... Mandril API key ...]'
DEFAULT_FROM_EMAIL = 'my-mandrill-allowed@email.address'
SERVER_EMAIL = 'my-mandrill-allowed@email.address'
And this setup works, except for the part that for some reason Mandrill doesn't allow setting the Message-Id
header:
NotSupportedByMandrillError: Invalid message header 'Message-Id' - Mandrill only allows Reply-To and X-* headers
(This exception is raised by djrill, is not a response from Mandrill)
Which is set by Sentry here:
class MessageBuilder(object):
# ...
@cached_property
def message_id(self):
if self.reference is not None:
return email_id_for_model(self.reference)
I have managed to make it work by editing that method and make it always return None
, so no Message-Id
header is set in the email. But I don't like to edit/patch 3rd party code and I have no idea if that header is needed elsewhere.
How to accomplish this correctly? Switching from Mandrill is not an option right now.
Thanks!