### Mailglass.MailerCase Setup Example Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Demonstrates the setup process for Mailglass.MailerCase, including sandbox checkout, fake adapter registration, tenant stamping, and clock freezing. ```elixir setup :set_mailglass_global # or setup do :ok = Mailglass.Adapters.Fake.checkout() :ok = Mailglass.Tenancy.put_current("test-tenant") :ok = Mailglass.Clock.Frozen.freeze(~U[2026-01-01 00:00:00Z]) end ``` -------------------------------- ### Release Please Configuration Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-oss-lib-ci-cd-best-practices-deep-research.md Example configuration for the Release Please action, which automates version bumping, changelog generation, and release creation based on Conventional Commits. ```yaml name: release-please on: push: branches: - main jobs: release-please: runs-on: ubuntu-latest steps: - uses: google-github-actions/release-please-action@v3 id: release with: release-type: elixir package-name: your-elixir-package - name: Publish to Hex if: steps.release.outputs.release_created run: mix hex.publish --yes ``` -------------------------------- ### Marketing Mail Dashboard Mount Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/Phoenix needs an email framework not another mailer.md Example of mounting the marketing mail dashboard in a Phoenix LiveView application. ```Elixir marketing_mail_dashboard ``` -------------------------------- ### Mailer Call Examples Source: https://github.com/sztheory/mailglass/blob/main/prompts/Phoenix needs an email framework not another mailer.md Examples of how to call mailer functions for sending emails synchronously or asynchronously. ```Elixir MyApp.Mailers.UserMailer.deliver(:welcome, user: u, magic_link: link) ``` ```Elixir MyApp.Mailers.UserMailer.deliver_later(:welcome, [user: u, magic_link: link], queue: :mailers) ``` ```Elixir MyApp.Mailers.UserMailer.deliver(:welcome, [...], tenant: current_tenant, locale: "fr") ``` -------------------------------- ### Mail Dashboard Mount Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/Phoenix needs an email framework not another mailer.md Example of mounting the mail dashboard in a Phoenix LiveView application for development. ```Elixir mail_dashboard "/dev/mail" ``` -------------------------------- ### Elixir OpenSearch Client Initialization Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Example of initializing an OpenSearch client with explicit runtime configuration. This approach avoids global state and allows for flexible configuration of adapters and options. ```elixir client = OpenSearch.Client.new( base_url: "...", transport: OpenSearch.Transport.Finch, json: Jason, retry: [...] ) ``` -------------------------------- ### Example Git Commit Scopes Source: https://github.com/sztheory/mailglass/blob/main/prompts/mailglass-engineering-dna-from-prior-libs.md This example shows the recommended commit message format for Mailglass, emphasizing scope by phase and feature. The commit body should detail the 'why' and reference the phase for traceability. ```git feat(send-04-02): feat(subs-02-03): test(phase-12): docs(phase-12): ``` -------------------------------- ### Mailglass.MailerCase Global Mode Setup Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Shows how to opt into global mode using `set_mailglass_global/1`, which requires `async: false` and sets `Fake.set_shared(self())`. ```elixir setup :set_mailglass_global # Requires async: false test "delivers to ETS bucket" do # ... end ``` -------------------------------- ### Actionlint Configuration Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-oss-lib-ci-cd-best-practices-deep-research.md Configuration for actionlint to lint GitHub Actions workflow files. This helps catch syntax errors, expression mistakes, and potential security issues in your workflows. ```yaml name: actionlint on: pull_request: paths: - ".github/workflows/**" jobs: actionlint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: rhysd/actionlint@v1 ``` -------------------------------- ### Dependency Review Configuration Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-oss-lib-ci-cd-best-practices-deep-research.md Configuration for the Dependency Review action to scan for vulnerable dependencies before they are merged into your project. This enhances workflow security. ```yaml name: dependency-review on: pull_request: jobs: dependency-review: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/dependency-review-action@v3 ``` -------------------------------- ### Elixir Library API Layering Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md An example of how to structure an Elixir library with distinct layers, promoting a stable public API while allowing internal evolution. This structure is idiomatic for Elixir users. ```elixir OpenSearch — public API OpenSearch.Client — client/config struct OpenSearch.Transport — behaviour OpenSearch.Transport.Finch — adapter OpenSearch.Request / OpenSearch.Response OpenSearch.Error OpenSearch.Telemetry OpenSearch.Testing or test helpers ``` -------------------------------- ### Accrue Installer Command Source: https://github.com/sztheory/mailglass/blob/main/prompts/mailglass-engineering-dna-from-prior-libs.md The `mix accrue.install` command generates host-owned context, migrations, router mounts, webhook stubs, and Oban wiring. It is designed to avoid overwriting user edits on reruns by using conflict sidecars. ```elixir mix accrue.install ``` -------------------------------- ### Elixir Fetching Environment Variable Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Demonstrates an anti-pattern of directly fetching environment variables from another application. This can lead to recompilation hazards and is discouraged. ```elixir Application.fetch_env!(:finch, ...) Application.fetch_env!(:jason, ...) ``` -------------------------------- ### Elixir Library Minimum Viable Flow Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Demonstrates the simplest way to initialize a client and perform a basic operation in an Elixir library. This flow should work without complex setup like supervisors or application configuration. ```elixir client = OpenSearch.Client.new(base_url: "...", api_key: "...") {:ok, resp} = OpenSearch.search(client, "products", %{query: %{match_all: %{}}}) ``` -------------------------------- ### Sigra Installer Command with Flags Source: https://github.com/sztheory/mailglass/blob/main/prompts/mailglass-engineering-dna-from-prior-libs.md The `mix sigra.install` command generates project components and supports a flag matrix for conditional code paths, such as `--no-passkeys` and `--no-organizations`. ```elixir mix sigra.install --no-passkeys --no-organizations ``` -------------------------------- ### Generate Mailglass Installers Source: https://github.com/sztheory/mailglass/blob/main/prompts/mailglass-engineering-dna-from-prior-libs.md Use `mix mailglass.install` to generate host-owned context, migrations, router mounts, Oban worker stubs, and default templates. Rerunning the command creates conflict sidecars instead of overwriting existing files. ```elixir mix mailglass.install ``` ```elixir mix mailglass.install --no-admin --no-marketing --no-inbound ``` -------------------------------- ### CI Workflow Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-oss-lib-ci-cd-best-practices-deep-research.md A comprehensive CI workflow for Elixir projects, including formatter checks, compilation with warnings as errors, tests, static analysis (Credo, Dialyzer), documentation builds, and dependency audits. ```yaml name: ci on: push: branches: [ main ] pull_request: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: version-file: '.github/workflows/elixir_version.txt' # Use exact versions for reproducibility otp-version: "26.1.2" elixir-version: "1.16.0" - name: Install dependencies run: mix deps.get - name: Credo run: mix credo --strict - name: Dialyzer run: mix dialyzer - name: Compile with warnings as errors run: mix compile --warnings-as-errors - name: Run tests with warnings as errors run: mix test --warnings-as-errors - name: Build docs with warnings as errors run: mix docs --warnings-as-errors - name: Hex audit run: mix hex.audit ``` -------------------------------- ### Define a Mailable with Mailglass Source: https://github.com/sztheory/mailglass/blob/main/README.md Create a mailable module using `Mailglass.Mailable`. This example defines a `welcome` function that constructs a new email message, sets the recipient and subject, and renders a template. ```elixir defmodule MyApp.UserMailer do use Mailglass.Mailable, stream: :transactional def welcome(user) do Mailglass.Message.new() |> Mailglass.Message.to(user.email) |> Mailglass.Message.subject("Welcome to MyApp") |> Mailglass.Message.render(MyApp.Mailing.Templates, :welcome, user: user) end end ``` -------------------------------- ### Elixir GenServer Interface Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Shows how to centralize process interactions behind a module interface, avoiding scattered direct GenServer calls. This promotes a cleaner API for users. ```elixir defmodule OpenSearch.ConnectionPool do def request(opts) do GenServer.call(__MODULE__, {:request, opts}) end end ``` -------------------------------- ### Dependabot Configuration Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-oss-lib-ci-cd-best-practices-deep-research.md Configuration for Dependabot to automatically update GitHub Actions and Elixir/Mix dependencies. This ensures your project stays up-to-date with the latest security patches and features. ```yaml version: 2 nupdates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" - package-ecosystem: "mix" directory: "/" schedule: interval: "weekly" ``` -------------------------------- ### Production Observability Metrics for LiveView Source: https://github.com/sztheory/mailglass/blob/main/prompts/phoenix-live-view-best-practices-deep-research.md A production-ready observability setup should track key metrics including mount timing, handle_event timing by event name/module, DB query timings, PubSub fanout counts, async task durations/failures, and reconnect/crash rates. ```elixir mount timing handle_event timing by event name / LiveView module DB query timings PubSub fanout counts async task durations/failures reconnect/crash rate stream-heavy screens and payload sizes where relevant ``` -------------------------------- ### LiveView Stream Setup Source: https://github.com/sztheory/mailglass/blob/main/prompts/phoenix-live-view-best-practices-deep-research.md The immediate parent of a stream must have `phx-update="stream"` and a unique DOM id. Each rendered stream item must use the computed stream DOM id. Do not mutate these generated IDs. ```html phx-update="stream" ``` -------------------------------- ### Run Default CI Gate Locally Source: https://github.com/sztheory/mailglass/blob/main/README.md Execute the default CI gate commands to verify the project setup locally. These commands ensure the project compiles correctly and adheres to specified standards. ```bash mix verify.phase_02 mix verify.cold_start mix compile --no-optional-deps --warnings-as-errors ``` -------------------------------- ### Use DynamicSupervisor for On-Demand Children Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-best-practices-deep-research.md Employ `DynamicSupervisor` when child processes are started on demand and can be numerous. It is optimized for dynamic children and can efficiently handle large numbers of them. ```elixir children = [ {DynamicSupervisor, name: MyApp.DynamicSup} ] Supervisor.start_link(children, strategy: :one_for_one) ``` -------------------------------- ### Asynchronous Data Loading in LiveView with assign_async/3 Source: https://github.com/sztheory/mailglass/blob/main/prompts/phoenix-best-practices-deep-research.md Use assign_async/3 for asynchronous page data loading. It starts tasks only when connected and expects explicit {:ok, assigns} / {:error, reason} contracts. ```elixir assign_async(socket, :user, fn -> fetch_user_data() end) assign_async(socket, :posts, fn -> fetch_posts_data() end) ``` -------------------------------- ### Test Cross-Process Delivery with LiveView and Fake Adapter Source: https://context7.com/sztheory/mailglass/llms.txt Test cross-process email delivery, for example, from a LiveView process, using the Fake adapter's `allow/2` function. This ensures emails are sent correctly across different processes. ```elixir test "cross-process delivery with LiveView" do owner = self() Mailglass.Adapters.Fake.allow(owner, spawn_link(fn -> Mailglass.deliver(msg) send(owner, :done) end)) assert_receive :done assert_mail_sent() end ``` -------------------------------- ### Elixir: GenServer for Runtime Characteristics Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-best-practices-deep-research.md Use GenServer to model runtime characteristics like connection ownership, rate limiting, or background refresh, not for code organization. Start a process only if you need its specific capabilities. ```elixir defmodule MyLib.ConnectionManager do use GenServer # Client API def start_link(opts) do GenServer.start_link(__MODULE__, opts, name: __MODULE__) end # GenServer callbacks def init(opts) do {:ok, state} end def handle_call({:get_connection, _id}, _from, state) do # ... logic to get connection ... {:reply, connection, new_state} end end ``` -------------------------------- ### Conventional Commit Example Source: https://github.com/sztheory/mailglass/blob/main/CLAUDE.md Example of a conventional commit message for state updates, which are filtered by CI. ```git docs(state): update planning state ``` -------------------------------- ### Test Assertion Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/Phoenix needs an email framework not another mailer.md Example of using Mail.TestAssertions to assert that a specific email was sent with given parameters. ```Elixir assert_mail_sent MailerMod, :scenario, fn params -> ... end ``` -------------------------------- ### Delivery with Options Source: https://context7.com/sztheory/mailglass/llms.txt Demonstrates sending emails synchronously and asynchronously with specific adapter options. ```elixir # With options Mailglass.deliver(msg, adapter: {Mailglass.Adapters.Swoosh, swoosh_adapter: Swoosh.Adapters.Test}) Mailglass.deliver_later(msg, async_adapter: :task_supervisor) ``` -------------------------------- ### Polymorphic Ownership Schema Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/mailglass-engineering-dna-from-prior-libs.md Elixir schema example for `mailglass_lists` demonstrating polymorphic ownership using `owner_type` and `owner_id` fields. This allows for flexible association with different owner types (e.g., User, Organization, Team) without foreign key constraints. ```APIDOC ## Polymorphic Ownership Schema ### Description Demonstrates a schema with polymorphic ownership, allowing a record to be associated with different types of owners. ### Method Elixir Schema Definition ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Elixir Schema Example ```elixir schema "mailglass_lists" do field :name, :string field :owner_type, :string # "User" | "Organization" | "Team" field :owner_id, :string # holds UUID/ULID/bigint as string # ... other fields end # Unique index example create unique_index(:mailglass_lists, [:owner_type, :owner_id, :name]) ``` ``` -------------------------------- ### Mailglass Documentation Contract Test Example Source: https://github.com/sztheory/mailglass/blob/main/prompts/mailglass-engineering-dna-from-prior-libs.md An example of a documentation contract test using ExUnit to verify that code snippets in documentation files (like README.md) are valid Elixir code and match actual public functions. This helps prevent documentation rot. ```elixir # test/mailglass/docs_contract_test.exs defmodule Mailglass.DocsContractTest do use ExUnit.Case, async: true test "README Quick Start snippet matches the actual public function" do snippet = File.read!("README.md") |> extract_codeblock("elixir-quickstart") assert snippet =~ "Mailglass.send(%{to: \"alice@example.com\", ...") # also: compile the snippet to ensure it parses Code.string_to_quoted!(snippet) end test "guides/golden-path.md config example matches Mailglass.Config schema" do ... end end ``` -------------------------------- ### LiveView Navigation Strategies Source: https://github.com/sztheory/mailglass/blob/main/prompts/phoenix-best-practices-deep-research.md Use patch/push_patch for same-LiveView updates, navigate/push_navigate for same-session LiveView transitions, and href/HTTP redirects for full reloads. ```elixir def handle_event("update_filter", %{"filter" => filter}, socket) do {:push_patch, socket |> assign(:filter, filter)} end def handle_event("change_page", %{"page" => page}, socket) do {:navigate, socket |> push_navigate(to: Routes.live_path(socket, MyAppWeb.SomeLive, page: page))} end ``` -------------------------------- ### Mailglass.WebhookCase Assertions Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Provides examples of using `assert_webhook_ingested/2` to verify webhook delivery events. ```elixir assert_webhook_ingested(:opened) assert_webhook_ingested(:opened, %{"X-Custom-Header" => "value"}) assert_webhook_ingested(:opened, meta_pattern) ``` -------------------------------- ### Mailglass ConfigError Example Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Illustrates the structure of the Mailglass.ConfigError raised when tracking is enabled on an auth stream. The context fields are PII-free. ```elixir %Mailglass.ConfigError{ type: :tracking_on_auth_stream, context: %{ mailable: MyApp.UserMailer, # module atom — not PII function: :magic_link # function atom — not PII } } ``` -------------------------------- ### Mailglass Admin Router Configuration Source: https://github.com/sztheory/mailglass/blob/main/prompts/mailglass-engineering-dna-from-prior-libs.md Example of how to mount the Mailglass Admin LiveView router within your application's router. ```elixir import MailglassAdmin.Router pipeline :require_admin, do: plug ... scope "/mail-admin" do pipe_through [:browser, :require_admin] mailglass_admin "/", scope: MyApp.MailScope end ``` -------------------------------- ### Get Webhook Fixture Root Path Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Returns the absolute path to the `test/support/fixtures/webhooks` directory, which contains webhook fixture files. ```elixir Mailglass.WebhookFixtures.fixture_root/0 ``` -------------------------------- ### GSD Workflow Commands Source: https://github.com/sztheory/mailglass/blob/main/CLAUDE.md Commands for managing the GSD (Get Shit Done) workflow, including planning, execution, and progress tracking. ```bash /gsd-plan-phase ``` ```bash /gsd-discuss-phase ``` ```bash /gsd-execute-phase ``` ```bash /gsd-progress ``` -------------------------------- ### Supervisor Strategies: :rest_for_one Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-best-practices-deep-research.md Use the `:rest_for_one` strategy when later children depend on earlier ones. If a child terminates, it and all children started after it are restarted. ```elixir Supervisor.start_link(children, strategy: :rest_for_one) ``` -------------------------------- ### Mount Mailglass Tracking Plug in router Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Configure your Plug.Router to forward tracking-related requests to `Mailglass.Tracking.Plug`. This setup allows the plug to handle open-pixel and click-redirect endpoints. ```elixir # In adopter's Endpoint or router: forward "/track", Mailglass.Tracking.Plug ``` -------------------------------- ### LiveView Async Operations Source: https://github.com/sztheory/mailglass/blob/main/prompts/phoenix-live-view-best-practices-deep-research.md Use `assign_async/3` for loading one or a few values into assigns, `start_async/3` for custom `handle_async/3` handling, and `stream_async/3` for collections destined for a stream. Show loading/failed/result states via `AsyncResult` or `<.async_result>`. ```elixir assign_async/3 ``` ```elixir start_async/3 ``` ```elixir stream_async/3 ``` ```elixir <.async_result> ``` -------------------------------- ### Get Last Mail Message Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Retrieves the most recent mail message from the Fake ETS bucket. This function is safe for async tests and provides per-process isolation. ```elixir last_mail() ``` -------------------------------- ### Create Postmark Basic Auth Header Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md Generates a Plug header tuple for Basic Authentication using provided username and password. Ready for use with `put_req_header/3`. ```elixir Mailglass.WebhookFixtures.postmark_basic_auth_header/2 ``` -------------------------------- ### Elixir Library Function Signatures Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Prefer explicit function signatures for common operations in Elixir libraries. These examples show a clear, data-first approach to function design. ```elixir OpenSearch.search(client, index, query, opts \ []) OpenSearch.get_document(client, index, id, opts \ []) OpenSearch.index_document(client, index, document, opts \ []) ``` -------------------------------- ### LiveView Patch vs Navigate Links Source: https://github.com/sztheory/mailglass/blob/main/prompts/phoenix-live-view-best-practices-deep-research.md Use `<.link patch={...}>` for same-LiveView state changes to preserve scroll and use minimal diffs. Use `<.link navigate={...}>` for moving between LiveViews to dismount the current and mount the next. ```elixir <.link patch={...}> ``` ```elixir <.link navigate={...}> ``` -------------------------------- ### LiveView Testing: State Machine Approach Source: https://github.com/sztheory/mailglass/blob/main/prompts/phoenix-live-view-best-practices-deep-research.md Test LiveViews as behavior/UI state machines rather than relying on large rendered snapshots. Use helpers like live/2, element/3, and form/3, focusing assertions on observable behavior and URL/state transitions. ```elixir Test LiveViews as behavior/UI state machines, not as giant rendered snapshots. Use live/2, element/3, form/3, render event helpers, and focused assertions on visible behavior. Use render_async/2 whenever async work is in play. Expect stricter DOM/component id correctness: LiveView 1.1 raises by default when LiveViewTest detects duplicate DOM or LiveComponent ids. If you upgraded from older tests, note that LiveViewTest moved from Floki to LazyHTML, so Floki-specific selectors no longer apply; use modern selectors or text_filter patterns instead. ``` -------------------------------- ### Elixir Telemetry Events for OpenSearch Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Example telemetry events for an OpenSearch library, suitable for stable instrumentation points. These events help track request lifecycle and potential errors. ```elixir [:opensearch, :request, :start] [:opensearch, :request, :stop] [:opensearch, :request, :exception] ``` -------------------------------- ### Ecto Style Recommendations Source: https://github.com/sztheory/mailglass/blob/main/prompts/ecto-best-practices-deep-research.md Recommended Ecto practices for building robust applications, including separate changesets for different operations, explicit preloads, and using Repo.transact/2 or Ecto.Multi for workflows. ```elixir separate create/update/security changesets explicit preloads explicit query builders Repo.transact/2 for simple workflows Ecto.Multi for dynamic/multi-step flows DB constraints everywhere correctness matters secret fields redacted consider load_in_query: false and writable: :insert/:never for sensitive/immutable fields ``` -------------------------------- ### Database Style Recommendations Source: https://github.com/sztheory/mailglass/blob/main/prompts/ecto-best-practices-deep-research.md Database-level recommendations for authentication libraries, emphasizing constraints, indexing strategies, and handling sensitive data. ```sql case-insensitive identifiers unique indexes for identities/tokens where applicable partial indexes for active-only uniqueness FK constraints check constraints for status/state coherence set-based cleanup for expired/revoked tokens ``` -------------------------------- ### Example HTML for open pixel tracking Source: https://github.com/sztheory/mailglass/blob/main/docs/api_stability.md This is the standard HTML markup for an open tracking pixel. It should be placed as the last child of the `` tag. If `` is missing, it will be appended to the document root. ```html ``` -------------------------------- ### Elixir Pattern Matching with OpenSearch Results Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Illustrates how to handle results from OpenSearch.search using pattern matching for success and error cases. This is the recommended approach over exception handling for expected failures. ```elixir {:ok, result} | {:error, exception} = OpenSearch.search(...) ``` -------------------------------- ### Use Task.Supervisor for Dynamic Task Supervision Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-best-practices-deep-research.md Utilize `Task.Supervisor` for managing dynamic task supervision. Be aware that it can become a bottleneck if heavily used and may require partitioning. ```elixir children = [ {Task.Supervisor, name: MyApp.TaskSupervisor} ] # ... start supervisor ``` -------------------------------- ### Elixir Child Specification for Background Workers Source: https://github.com/sztheory/mailglass/blob/main/prompts/elixir-opensource-libs-best-practices-deep-research.md Provides an example of a child specification for a background worker, intended to be used within a supervision tree. This allows users to control the lifecycle of background processes. ```elixir %{id: ..., start: ...} ``` -------------------------------- ### Configure Postmark and SendGrid Credentials Source: https://github.com/sztheory/mailglass/blob/main/guides/webhooks.md Configure Mailglass provider credentials in your runtime configuration. For Postmark, enable it and provide basic authentication credentials. For SendGrid, enable it and provide the public key and timestamp tolerance. ```elixir config :mailglass, :postmark, enabled: true, basic_auth: {System.fetch_env!("POSTMARK_WEBHOOK_USER"), System.fetch_env!("POSTMARK_WEBHOOK_PASS")} config :mailglass, :sendgrid, enabled: true, public_key: System.fetch_env!("SENDGRID_WEBHOOK_PUBLIC_KEY"), timestamp_tolerance_seconds: 300 ```