# C0: continuity/CSAT emails never delivered (missing inbound email domain) ## Impact Since the 14:37Z Sidekiq restart no continuity or CSAT email was delivered. Scenario runs C1 (conv 18), C3 (19), F-C1 (20), F-C3 (21), C2 (22, resolved 14:55:38Z with a template message) and F-C2 (23) are not tested continuity triggers: label "no email: delivery job failed (C0), not a tested continuity trigger". Absence of mail in the F-* runs proves nothing. Milestone C email conclusions (C1/C2/C3 triggers and bodies) remain unverified until re-run after the fix. ## Observed (Sidekiq log figures as reported to me; I did not re-read the host logs) - 20x "Error performing ActionMailer::MailDeliveryJob", StandardError "Channel email domain not present." at app/mailers/conversation_reply_mailer_helper.rb:120, raised via ConversationReplyMailerHelper#channel_email_domain from ConversationReplyMailer#custom_message_id and #reply_with_summary. - 0 "Delivered mail" lines since the restart. - Supervisor mailbox check 15:07Z (evidence/C/mailbox/mailbox-check-1.json, smtp-test-received.json): only SMTP test 1 (13:17:56Z) and SMTP test 2 (14:38:45Z) were received; nothing for C1, C3, F-C1, F-C3, C2 or F-C2. SMTP transport itself works (the two tests were received). ## Root cause (source-based, v4.19.0, read by me) - [conversation_reply_mailer_helper.rb#L116-L121](https://github.com/chatwoot/chatwoot/blob/v4.19.0/app/mailers/conversation_reply_mailer_helper.rb#L116-L121): `channel_email_domain` returns `@account.inbound_email_domain` if present, else the domain of `@inbox.channel.email` if present, else raises `StandardError, 'Channel email domain not present.'` (the raise is line 120). - [conversation_reply_mailer.rb#L152-L156](https://github.com/chatwoot/chatwoot/blob/v4.19.0/app/mailers/conversation_reply_mailer.rb#L152-L156): `custom_message_id` interpolates `channel_email_domain` into the Message-ID; `in_reply_to_email` ([L159-L163](https://github.com/chatwoot/chatwoot/blob/v4.19.0/app/mailers/conversation_reply_mailer.rb#L159-L163)) does too. [reply_with_summary](https://github.com/chatwoot/chatwoot/blob/v4.19.0/app/mailers/conversation_reply_mailer.rb#L12-L22) ends in `prepare_mail`, which builds the Message-ID (reported stack goes through custom_message_id). - [account.rb#L154-L157](https://github.com/chatwoot/chatwoot/blob/v4.19.0/app/models/account.rb#L154-L157): `inbound_email_domain` = `account.domain` (if present), else global config / ENV `MAILER_INBOUND_EMAIL_DOMAIN`, else false. The `domain` column is documented as the inbound email domain ([L45-L47](https://github.com/chatwoot/chatwoot/blob/v4.19.0/app/models/account.rb#L45-L47)). - A website (web widget) inbox channel has no `email` attribute (inference from the source and the error), so the fallback is empty and the job raises. I did not inspect the running account domain or the host ENV (no host access); the error is consistent with both being unset. - [.env.example#L128-L130](https://github.com/chatwoot/chatwoot/blob/v4.19.0/.env.example#L128-L130): `MAILER_INBOUND_EMAIL_DOMAIN` is "the domain set for the reply emails when conversation continuity is enabled". ## Fix (not applied; host/config change for the deployment agent) Set `MAILER_INBOUND_EMAIL_DOMAIN` (for example the lab mail domain, chatwoot.railsfanatics.com) in the host env for web and Sidekiq and restart both; alternatively set the account `domain` through the account settings. Then re-run C1, C3, C2 and the F-* controls as new conversations and check the mailbox. Those would be new runs, not covered here. ## Observed vs source-based - Observed: error text, count, location, absence of "Delivered mail", mailbox contents at 15:07Z. - Source-based (untested): why the domain is missing, that the website inbox has no channel email, and that the env var or account domain fixes it.