Skip to content

Fix can_use_transactional_email field name mismatch and update SRS forwarding tests#470

Merged
jdelic merged 2 commits intofeature/separate-forward-relayfrom
copilot/update-mailforwarder-tests-another-one
Mar 9, 2026
Merged

Fix can_use_transactional_email field name mismatch and update SRS forwarding tests#470
jdelic merged 2 commits intofeature/separate-forward-relayfrom
copilot/update-mailforwarder-tests-another-one

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

ForwarderServer._process_message referenced domain.can_use_transactional_relay — a field that doesn't exist on the Domain model (the actual field is can_use_transactional_email), silently disabling transactional relay routing. The SRS forwarding tests also broke when _rewrite_mailfrom was removed in favour of inline self.srs.forward() calls.

maildaemons/forwarder/server.py

  • Fix domain.can_use_transactional_relaydomain.can_use_transactional_email in both the runtime routing condition and the --transactional-relay-ip CLI help text.
  • transactional_relay as a parameter/argument name is correct and unchanged — it names the SMTP relay, not the model field.

mailauth/tests/test_mailforwarder_srs.py

  • Replace test_rewrite_mailfrom_uses_static_sender_without_srs / test_rewrite_mailfrom_uses_srs_when_available (tested the removed _rewrite_mailfrom method) with _process_message-level equivalents:
    • test_process_message_uses_list_mailfrom_when_setforward_to.new_mailfrom is used directly as envelope sender when set.
    • test_process_message_uses_srs_when_list_mailfrom_not_set — SRS rewrites the sender when new_mailfrom is empty.
  • Fix test_process_message_uses_rewritten_mailfrom_for_forwarding → renamed test_process_message_list_mailfrom_overrides_srs_when_set: add missing domain=SimpleNamespace(name=...) on the alias (the current code calls alias.domain.name), remove mock of the deleted _rewrite_mailfrom, clarify that a non-empty new_mailfrom wins even when SRS is configured.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: jdelic <1956349+jdelic@users.noreply.github.com>
Copilot AI changed the title [WIP] Update tests for mailforwarder with new transactional email logic Fix can_use_transactional_email field name mismatch and update SRS forwarding tests Mar 9, 2026
@jdelic jdelic marked this pull request as ready for review March 9, 2026 15:42
@jdelic jdelic merged commit b3e35fb into feature/separate-forward-relay Mar 9, 2026
@jdelic jdelic deleted the copilot/update-mailforwarder-tests-another-one branch March 9, 2026 15:42
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.

2 participants