使用 django-sentry 不起作用时发送错误邮件
我正在使用 django-sentry 来记录错误。我还想在发生错误时将受限制的错误邮件发送给管理员。但我无法让它工作。
a) 正常的 django 错误邮件正常工作。 b) 但是在删除 ADMINS 并添加 SENTRY_ADMINS(如下所示)时,它会停止工作:
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SENTRY_TESTING = True
ADMINS = ()
SENTRY_ADMINS = ('[email protected]',)
MANAGERS = ADMINS
MIDDLEWARE_CLASSES = (
'sentry.client.middleware.SentryResponseErrorIdMiddleware',
....
)
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
尽管条目已正确创建并显示在面板中。我在测试之前将所有错误标记为已解决(以满足哨兵的节流条件),但它仍然无法正常工作。
谁能指出我在这里做错了什么?
I am using django-sentry for logging errors. I also want to enable throttled error mails to be sent to admins whenever an error occurs. But I can not get it working.
a) Normal django error mailing is working.
b) but on removing ADMINS and adding SENTRY_ADMINS(like below) it stops working:
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SENTRY_TESTING = True
ADMINS = ()
SENTRY_ADMINS = ('[email protected]',)
MANAGERS = ADMINS
MIDDLEWARE_CLASSES = (
'sentry.client.middleware.SentryResponseErrorIdMiddleware',
....
)
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
Though entries are correctly being made and shown in panel. I mark all errors as resolved before testing(to satisfy throttle condition of sentry) but it is still not working.
Can anyone point to what I am doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
贾罗几乎是正确的。 Sentry(以及 Django 本身)使用的发件人地址由 settings.SERVER_EMAIL 定义。它将仅使用 SENTRY_ADMINS 地址发送电子邮件至。
因此,设置
SERVER_EMAIL = EMAIL_HOST_USER
应该可以解决此问题。Jiaaro is almost correct. The From address used by Sentry (and Django itself) is defined by settings.SERVER_EMAIL. It will use the SENTRY_ADMINS addresses only to send email to.
So setting
SERVER_EMAIL = EMAIL_HOST_USER
should fix this.我相信问题是您正在尝试使用 gmail 发送邮件,但您正在尝试从“[电子邮件受保护]"
据我所知,gmail 不允许您从未经验证拥有的电子邮件地址(在 gmail 中)发送邮件。
尝试将您的 SENTRY_ADMINS 设置为...
I believe the issue is that you are trying to use gmail to send the messages but you are trying to send the messages from "[email protected]"
As far as I know, gmail does not allow you to send messages from email addresses which you are not a verified as owning (in gmail).
Try setting your SENTRY_ADMINS to...