PhoenixKit.Email.CoreTemplates (phoenix_kit v2.45.0)

Copy Markdown View Source

The emails core itself sends, as PhoenixKit.Email.Catalog entries.

Each email's default copy is a named function here, not a closure at the send site, because two callers need the same copy: the send (PhoenixKit.Users.Auth.UserNotifier, PhoenixKit.Mailer.send_magic_link_email/2) and the admin preview. One function means the preview can never show copy the send no longer uses.

Every *_defaults/0 is a zero-arity function so PhoenixKit.Email.Content can evaluate it inside the recipient's locale — see "Why the default is a function" there.

Summary

Functions

The catalog entries for core's emails, in the order the admin lists them.

The {{failed_attempts}} paragraph of the new login alert for count failures in the last 24 hours: empty (not "0") when there were none, else a sentence carrying its own trailing blank line, so the paragraph collapses cleanly instead of leaving a gap.

Default copy of the failed sign-in alert (failed_login_alert).

The {{location}} line of the new login alert: the geolocated place, marked approximate, or "Unknown".

Default copy of the magic link sign-in email (magic_link).

Default copy of the magic link registration email (magic_link_registration).

Default copy of the new login alert (new_login_alert).

Default copy of the organization invitation (organization_invitation).

Default copy of the account confirmation email (register).

Default copy of the password reset email (reset_password).

Default copy of the email change confirmation (update_email).

Functions

entries()

@spec entries() :: [PhoenixKit.Email.Catalog.entry()]

The catalog entries for core's emails, in the order the admin lists them.

Labels and descriptions are evaluated on the call, so call this in the locale they should read in. Defaults and sample variables are closures, evaluated later by the preview in the locale being previewed.

failed_attempts_note(count)

@spec failed_attempts_note(non_neg_integer()) :: String.t()

The {{failed_attempts}} paragraph of the new login alert for count failures in the last 24 hours: empty (not "0") when there were none, else a sentence carrying its own trailing blank line, so the paragraph collapses cleanly instead of leaving a gap.

failed_login_alert_defaults()

@spec failed_login_alert_defaults() :: PhoenixKit.Templates.defaults()

Default copy of the failed sign-in alert (failed_login_alert).

location_line(location)

@spec location_line(term()) :: String.t()

The {{location}} line of the new login alert: the geolocated place, marked approximate, or "Unknown".

IP geolocation is city-accurate at best and routinely a hundred kilometres out. Saying so is the difference between a reader dismissing a genuine alert because the city looks wrong and a reader checking the device.

new_login_alert_defaults()

@spec new_login_alert_defaults() :: PhoenixKit.Templates.defaults()

Default copy of the new login alert (new_login_alert).

organization_invitation_defaults()

@spec organization_invitation_defaults() :: PhoenixKit.Templates.defaults()

Default copy of the organization invitation (organization_invitation).

register_defaults()

@spec register_defaults() :: PhoenixKit.Templates.defaults()

Default copy of the account confirmation email (register).

reset_password_defaults()

@spec reset_password_defaults() :: PhoenixKit.Templates.defaults()

Default copy of the password reset email (reset_password).

update_email_defaults()

@spec update_email_defaults() :: PhoenixKit.Templates.defaults()

Default copy of the email change confirmation (update_email).