Skip to content

Implement e-mail sending suppression - #6681

Open
aerosol wants to merge 4 commits into
masterfrom
postmark-webhooks-schema
Open

aerosol wants to merge 4 commits into
masterfrom
postmark-webhooks-schema

Conversation

@aerosol

@aerosol aerosol commented Sep 16, 2026

Copy link
Copy Markdown
Member

Changes

This PR sets a base for e-mail suppression, based on Postmark-proxied bounce/complaint data.
Migration will be extracted to a separate PR once review is concluded.

Continued in: #6685

Tests

  • Automated tests have been added
  • This PR does not require tests

Changelog

  • Entry has been added to changelog
  • This PR does not make a user-facing change

Documentation

  • Docs have been updated
  • This change does not need a documentation update

Dark mode

  • The UI has been tested both in dark and light mode
  • This PR does not change the UI

@aerosol
aerosol requested a review from a team September 16, 2026 05:14
@aerosol
aerosol force-pushed the postmark-webhooks-schema branch from e043f4b to 7e669be Compare September 16, 2026 05:17
@aerosol
aerosol force-pushed the postmark-webhooks-schema branch from 7e669be to 7cbd134 Compare September 16, 2026 05:27
Comment thread lib/plausible/mailer.ex Outdated
# each possibly wrapped in a list.
normalized = Bamboo.Mailer.normalize_addresses(email)

[normalized.to, normalized.cc, normalized.bcc]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do any carbon copying now AFAIK, but it's going to be nice to have some behavior defined, if we ever do. Maybe some e-mail notifications targeting multiple team members could be wrapped in a single message in the future.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm considering just crashing here if there's more than 1 address

@aerosol
aerosol removed the request for review from a team September 16, 2026 07:13
@aerosol
aerosol marked this pull request as draft September 16, 2026 07:13
Comment thread lib/plausible/mailer.ex
@aerosol
aerosol marked this pull request as ready for review September 16, 2026 11:38
@aerosol
aerosol requested a review from a team September 16, 2026 11:38
end

@spec reactivate_changeset(t(), pos_integer()) :: Ecto.Changeset.t()
def reactivate_changeset(suppression, user_id) do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, feel free to ignore: To make the API slightly less confusing, the changeset could accept User struct and use id field only, internally.


suppression ->
suppression
|> EmailSuppression.reactivate_changeset(user_id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reactivation overriding any future postmark updates is intentional, correct?

@aerosol aerosol Sep 17, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was intentional but it's a good question nevertheless.
Reactivating like that means we will never deactivate.

@metmarkosaric once you manually reactivate an address, and then subsequent send results with some error still, should we deactivate the address or keep it active (application-side) until manually deactivated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aerosol hmm in that case I think it is best to deactivate if the error again happens to be one of those we don't send emails for. we won't be manually deactivating addresses on our own

Comment thread lib/plausible/mailer.ex
Comment thread lib/plausible/mailer.ex
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.

3 participants