GenServer owning the :mailglass_fake_mailbox ETS table. Mirrors
Swoosh.Adapters.Sandbox.Storage pattern: the GenServer handles ownership
mutations (checkout, checkin, allow, set_shared, find_owner,
{:DOWN, ...}) but READS happen directly against ETS to bypass the mailbox.
State
:owners— MapSet of currently-checked-out owner pids.:allowed— mapallowed_pid => owner_pidfor allow-list delegation (LiveView, Playwright, Oban worker processes).:shared— single owner pid for global-mode tests (set viaset_shared/1).:monitors— mapmonitor_ref => pidfor auto-cleanup on DOWN.
ETS table
:mailglass_fake_mailbox — [:set, :named_table, :public, {:read_concurrency, true}].
Keys: owner pid. Values: list of records (prepended on each push, so newest is head).
Divergences from Swoosh.Adapters.Sandbox.Storage
- Table name:
:mailglass_fake_mailbox(not:swoosh_sandbox_emails). - Stored value:
%{message: %Mailglass.Message{}, delivery_id: binary(), provider_message_id: binary(), recorded_at: DateTime.t()}— not a bare email. send(owner_pid, {:mail, msg})— not{:email, email}.push/2acceptsowner_pid + record_map; stores full record in ETS.
Summary
Functions
Returns all records for the given owner pid. Newest first.
Returns a specification to start this module under a supervisor.
Removes the ETS entry for the given owner pid.
Removes all entries from the ETS table (used by Fake.clear(:all)).
Functions
Returns all records for the given owner pid. Newest first.
Returns a specification to start this module under a supervisor.
See Supervisor.
Removes the ETS entry for the given owner pid.
Removes all entries from the ETS table (used by Fake.clear(:all)).