
Vishnu NarayananandGitHub
c884cdefde
feat: add per-account daily rate limit for outbound emails (#13411)
Introduce a daily cap on non-channel outbound emails to prevent abuse.
Fixes https://linear.app/chatwoot/issue/CW-6418/ses-incident-jan-28
## Type of change
- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality not to work as expected)
## Summary
- Adds a Redis-based daily counter to rate limit outbound emails per
account, preventing email abuse
- Covers continuity emails (WebWidget/API), conversation transcripts,
and agent notifications
- Email channel replies are excluded (paid feature, not abusable)
- Adds account suspension check in `ConversationReplyMailer` to block
already-queued emails for suspended accounts
## Limit Resolution Hierarchy
1. Per-account override (`account.limits['emails']`) — SuperAdmin
configurable
2. Enterprise plan-based (`ACCOUNT_EMAILS_PLAN_LIMITS`
InstallationConfig)
3. Global default (`ACCOUNT_EMAILS_LIMIT` InstallationConfig, default:
100)
4. Fallback (`ChatwootApp.max_limit` — effectively unlimited)
## Enforcement Points
| Path | Where | Behavior |
|------|-------|----------|
| WebWidget/API continuity |
`SendEmailNotificationService#should_send_email_notification?` |
Silently skipped |
| Widget transcript | `Widget::ConversationsController#transcript` |
Returns 429 |
| API transcript | `ConversationsController#transcript` | Returns 429 |
| Agent notifications | `Notification::EmailNotificationService#perform`
| Silently skipped |
| Email channel replies | Not rate limited | Paid feature |
| Suspended accounts | `ConversationReplyMailer` | Blocked at mailer
level |
2026-02-03 02:06:51 +05:30
..
2023-10-10 08:20:48 +05:30
2025-08-18 19:15:21 -07:00
2026-01-12 19:54:19 +05:30
2025-12-19 17:07:53 -08:00
2025-05-20 19:22:17 -07:00
2025-11-18 18:20:58 -08:00
2025-06-18 17:39:06 +05:30
2025-08-18 19:15:21 -07:00
2025-06-18 17:39:06 +05:30
2025-10-22 20:23:37 -07:00
2025-06-18 17:39:06 +05:30
2025-07-14 21:37:06 -07:00
2025-12-17 07:54:50 -08:00
2021-02-16 19:35:10 +05:30
2025-09-15 19:59:56 +05:30
2025-11-18 18:20:58 -08:00
2025-04-09 08:53:13 +05:30
2025-11-13 12:07:24 +05:30
2022-05-23 19:24:07 +05:30
2025-08-18 19:15:21 -07:00
2025-12-19 19:02:21 -08:00
2022-03-16 13:54:18 +05:30
2025-11-04 17:47:53 -08:00
2025-07-17 18:32:12 +05:30
2025-07-16 09:04:02 +05:30
2023-02-06 12:53:48 -08:00
2023-10-20 13:52:30 +05:30
2023-09-28 15:26:28 -07:00
2026-01-27 18:55:19 -08:00
2026-02-03 02:06:51 +05:30
2026-01-15 19:53:57 -08:00
2024-01-23 18:01:57 +04:00
2025-05-08 20:12:05 -07:00
2022-06-01 11:13:10 +05:30
2026-01-13 16:32:02 +04:00
2025-02-20 21:28:38 -08:00
2026-01-13 16:32:02 +04:00
2022-03-24 13:28:25 +05:30
2025-12-19 19:02:21 -08:00
2020-06-07 13:58:05 +05:30
2024-02-20 18:55:39 +05:30
2025-06-18 17:39:06 +05:30
2025-12-19 19:02:21 -08:00
2026-01-07 15:30:49 +05:30
2025-02-20 21:28:38 -08:00
2022-03-24 13:28:25 +05:30
2025-12-19 19:02:21 -08:00
2025-11-13 13:28:15 +05:30
2020-11-01 00:14:33 +05:30