使用 django-sentry 不起作用时发送错误邮件

发布于 2024-10-20 05:30:07 字数 876 浏览 7 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

趁年轻赶紧闹 2024-10-27 05:30:07

贾罗几乎是正确的。 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.

感情旳空白 2024-10-27 05:30:07

我相信问题是您正在尝试使用 gmail 发送邮件,但您正在尝试从“[电子邮件受保护]"

据我所知,gmail 不允许您从未经验证拥有的电子邮件地址(在 gmail 中)发送邮件。

尝试将您的 SENTRY_ADMINS 设置为...

SENTRY_ADMINS = (
  "[email protected]",
)

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...

SENTRY_ADMINS = (
  "[email protected]",
)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文