Skip to content

fix(mailer): remove freemail Reply-To to fix rspamd SPOOF_REPLYTO junking - #472

Closed
Neophytis wants to merge 1 commit into
masterfrom
blackfalconx/fix-feedback-spam-replyto
Closed

fix(mailer): remove freemail Reply-To to fix rspamd SPOOF_REPLYTO junking#472
Neophytis wants to merge 1 commit into
masterfrom
blackfalconx/fix-feedback-spam-replyto

Conversation

@Neophytis

Copy link
Copy Markdown
Contributor

Problem

PR #471 fixed DMARC by switching to From: noreply@bewelcome.org, but kept Reply-To: <reporter@freemail> so staff could reply directly. This still causes feedback emails to land in Junk — rspamd scores SPOOF_REPLYTO(6.00) + FREEMAIL_REPLYTO_NEQ_FROM(2.00) = 8 pts when Reply-To domain (yahoo.fr, gmail.com, etc.) differs from From domain (bewelcome.org). Combined with baseline spam signals this pushes past the Junk threshold. OTRS only polls INBOX, so submissions are silently lost.

We confirmed 4 emails from 2026-08-05 were stuck in bw-otrs@bewelcome.org Junk, including Gabriel's Safety and Software issues reports that triggered this investigation. Those 4 have been manually moved to INBOX via doveadm.

Fix

Remove Reply-To from sendFeedbackEmail and sendCommentReportedFeedbackEmail. The reporter's email is already shown in the email body by both templates (the feedback.html.twig template was already updated in #471; comment.feedback.html.twig was not — fixed here by adding {{ reporterEmail }}).

OTRS agents can see and copy the reporter's address from the body. For OTRS workflow specifically, agents reply from within OTRS using the queue's system_address, not the raw email Reply button.

What OTRS routing looks like

All feedback addresses (abuse@, account@, bugs@, etc.) are Mailcow aliases → bw-otrs@bewelcome.org. OTRS PostMaster filters match the original To: header and route to the correct queue automatically — no change needed there.

Test plan

  • Run php bin/phpunit tests/Service/MailerTest.php — all 3 tests pass
  • Submit a test feedback form with a Yahoo/Gmail address — confirm it arrives in OTRS (not Junk)
  • Report a comment as a user with a freemail address — confirm OTRS ticket is created

… junking

PR #471 kept Reply-To: <reporter@freemail> to let staff reply directly, but
this triggers SPOOF_REPLYTO(6.00) + FREEMAIL_REPLYTO_NEQ_FROM(2.00) in rspamd
(~8 pts total), pushing feedback emails past the Junk threshold and losing them
before OTRS ever polls the mailbox.

The reporter's address is already rendered in both email body templates, so
OTRS agents can see and copy it. Remove Reply-To from sendFeedbackEmail and
sendCommentReportedFeedbackEmail; surface reporter email in comment.feedback
template body (was only accessible via the now-removed header).

Update unit tests to assert Reply-To is absent.
@Neophytis

Copy link
Copy Markdown
Contributor Author

Closing in favour of an rspamd-side fix.

The root cause was that Mailcow's rspamd scored SPOOF_REPLYTO (+6) and FREEMAIL_REPLYTO_NEQ_FROM (+2) on feedback form emails where the Reply-To is the submitter's Gmail address. Combined with BAYES_SPAM and BAD_REP_POLICIES, the total score exceeded the spam-flag threshold, routing OTRS tickets to Junk.

The correct fix is two rspamd composites in composites.conf that cancel those symbols when R_DKIM_ALLOW and MAILCOW_DOMAIN_HEADER_FROM both fire — i.e. only for DKIM-authenticated mail from Mailcow-managed domains. This is gated on DKIM so a spammer cannot exploit it, and any spoofed noreply@bewelcome.org would still hit DMARC_POLICY_REJECT (+16) regardless.

Removing Reply-To at the application layer would break OTRS agent replies (agents would reply to noreply@bewelcome.org which discards mail instead of to the feedback submitter).

The fix is live on bobcat-prod. Score on feedback emails is now ~5.0 (no action), down from ~11 (add header).

@Neophytis Neophytis closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant