fix: properly quote agent display names with special characters in email From header#13733
fix: properly quote agent display names with special characters in email From header#13733realsamrat wants to merge 4 commits intochatwoot:developfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 573479202a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| I18n.t('conversations.reply.email.header.professional_name', business_name: business_name, from_email: sender_email) | ||
| end | ||
| display_name = if @inbox.friendly? | ||
| "#{custom_sender_name} from #{business_name}" |
There was a problem hiding this comment.
Restore localized sender name formatting
This change hardcodes the friendly display name as "#{custom_sender_name} from #{business_name}" instead of using the existing i18n keys, so all non-English locales (and any custom translation overrides) now emit an English From label and English word order. That is a regression for localized deployments because the previous implementation used conversations.reply.email.header.friendly_name / professional_name templates across locale files, and those translations are no longer applied in this mailer path.
Useful? React with 👍 / 👎.
Description
Fixes email delivery failures when an agent's display name contains punctuation characters such as periods, commas, or other RFC 5322 special characters (e.g., "Dr. Julio Menezes").
Per RFC 5322, display names in email headers that contain special characters must be properly quoted. Previously, Chatwoot constructed the From header by interpolating the agent name directly into the string without quoting, causing SMTP servers to reject or misparse the header.
This change uses Ruby's
Mail::Addressclass to properly encode display names with special characters, ensuring RFC 5322 compliance.Fixes #13667
Type of change
How Has This Been Tested?
spec/mailers/conversation_reply_mailer_spec.rbthat verify agent names containing periods and other RFC 5322 special characters are properly encoded in the From headerChecklist: