Skip to content

Newsletters 0.1.8: Broadcasts to user roles and an email preferences page

Newsletters 0.1.8 lets you send a broadcast to your users by role, without the CRM module, and adds an Email preferences page where readers choose which newsletters they get.

Roles as an audience

Next to Newsletter list and CRM list, the broadcast editor offers Roles: pick one or more user roles and the broadcast goes to those users. The editor shows the same breakdown of sendable addresses as for the other audiences. Role recipients get their own one-click unsubscribe link, which records the opt-out on the user and, when linked, on their CRM contact too. Deactivated users no longer receive newsletter list broadcasts either.

Email preferences

A new Email preferences page at /newsletters/preferences lists every subscribable CRM list as a toggle, with Unsubscribe from all and Resubscribe. Readers reach it from a broadcast email through a signed link that needs no login, using the {{preferences_url}} tag, and logged-in users find it in their account menu. Without the CRM module the page shows a message instead of failing.

Translations

The new role strings are translated into Estonian and Russian.

Full release notes: Newsletters 0.1.8

0.1.8 · 21 July 2026

Added

  • New user_group broadcast recipient source — target core users by role (PhoenixKit.Users.Roles/RoleAssignment) directly, without requiring the CRM module. The broadcast editor gains a “Roles” multi-select alongside “Newsletter list”/“CRM list”, with the same sendable/no-email/unsendable preflight breakdown as the other sources.
  • A dedicated unsubscribe/opt-out flow for role-sourced recipients: a separately-salted one-click token, a confirm/already-unsubscribed/unsubscribed landing page, and UserGroupSource.record_opt_out/1, which writes the user’s own opt-out state and (when linked) the corresponding CRM contact’s, keeping both consistent.

Fixed

  • A role-sourced (user_group) delivery’s unsubscribe link previously reused the newsletters_list token shape with a nil list_uuid, so it verified but silently opted nobody out; it now signs its own token flavor.
  • newsletters_list sends now exclude deactivated (is_active: false) users, matching what user_group already excluded — previously a deactivated user with a stale “active” ListMember row still received newsletters_list broadcasts.
  • The broadcast editor’s role list is now loaded in handle_params/3 instead of mount/3, avoiding a doubled roles query on every visit to the page (mount/3 runs once for the disconnected render, once for the connected one) — matches how the newsletter/CRM list options were already loaded.
  • The new “Roles” recipient-source UI strings (role picker label, preflight summary, stale-role warning) are now fully translated (en/et/ru); they had shipped without gettext extraction.

Newsletters 0.1.8. Install or update: {:phoenix_kit_newsletters, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.