inbound-mail.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Inbound Mail
  2. ============
  3. Sentry provides support for handling incoming email in various situations.
  4. Currently it only supports processing replies to error and note
  5. notifications.
  6. For configuration you can pick from different backends.
  7. Inbound Email via Mailgun
  8. -------------------------
  9. .. versionadded:: 7.2.0
  10. Start by choosing a domain to handle inbound email. We find it easiest if
  11. you maintain a separate domain from anything else. In our example, we're
  12. going to choose ``inbound.sentry.example.com``. You'll need to configure
  13. your DNS records for the given domain according to the Mailgun
  14. documentation.
  15. Create a new route in mailgun::
  16. Priority:
  17. 0
  18. Filter Expression:
  19. catch_all()
  20. Actions:
  21. forward("https://sentry.example.com/api/hooks/mailgun/inbound/")
  22. Description:
  23. Sentry inbound handler
  24. Configure Sentry with the appropriate settings:
  25. .. code-block:: yaml
  26. # Your Mailgun API key (used to verify incoming webhooks)
  27. mail.mailgun-api-key: ''
  28. # Set the SMTP hostname to your configured inbound domain
  29. mail.reply-hostname: 'inbound.sentry.example.com'
  30. # Inform Sentry to send the appropriate mail headers to enable
  31. # incoming replies
  32. mail.enable-replies: true
  33. That's it! You'll now be able to respond to activity notifications on
  34. errors via your email client.
  35. .. _nginx-mail:
  36. Inbound Email via Nginx
  37. -----------------------
  38. Start by choosing a domain to handle inbound email. We find it easiest if
  39. you maintain a separate domain from anything else. In our example, we're
  40. going to choose ``inbound.sentry.example.com``. You'll need to configure
  41. your DNS records appropriately.
  42. Add another supervisor config to run the Sentry ``smtp`` service::
  43. [program:sentry-inbound-mail]
  44. directory=/www/sentry/
  45. command=/www/sentry/bin/sentry run smtp
  46. autostart=true
  47. autorestart=true
  48. stdout_logfile syslog
  49. stderr_logfile syslog
  50. Configure an Nginx route as an SMTP mail proxy::
  51. http {
  52. # Bind an http server to localhost only just for the smtp auth
  53. server {
  54. listen 127.0.0.1:80;
  55. # Return back the address and port for the listening
  56. # Sentry smtp server. Default is 127.0.0.1:1025.
  57. location = /smtp {
  58. add_header Auth-Server 127.0.0.1;
  59. add_header Auth-Port 1025;
  60. return 200;
  61. }
  62. }
  63. }
  64. mail {
  65. auth_http localhost/smtp;
  66. server {
  67. listen 25;
  68. protocol smtp;
  69. proxy on;
  70. smtp_auth none;
  71. xclient off;
  72. }
  73. }
  74. And finally, update Sentry with the appropriate settings:
  75. .. code-block:: yaml
  76. # Set the SMTP hostname to your configured inbound domain
  77. mail.reply-hostname: 'inbound.sentry.example.com'
  78. # Inform Sentry to send the appropriate mail headers to enable
  79. # incoming replies
  80. mail.enable-replies: true
  81. That's it! You'll now be able to respond to activity notifications on
  82. errors via your email client.