# `Mailglass.OptionalDeps`
[🔗](https://github.com/szTheory/mailglass/blob/v2.7.0/lib/mailglass/optional_deps.ex#L1)

Namespace for optional dependency gateway modules.

Each submodule gates one optional dependency behind a `Code.ensure_loaded?/1`
check and exposes `available?/0`. The `@compile {:no_warn_undefined, ...}`
declaration in each gateway module (and the corresponding project-level
`elixirc_options` list in `mix.exs`) suppresses compiler warnings when the
dep is absent, so `mix compile --no-optional-deps --warnings-as-errors`
stays green across the full matrix.

## Pattern

- **Compile-time:** `@compile {:no_warn_undefined, [Module.Name, ...]}` as
  the first declaration inside the gateway module, scoped to exactly the
  modules the gateway wraps.
- **Runtime:** `available?/0` delegates to `Code.ensure_loaded?/1` so callers
  can branch between the real dep and a degraded fallback without compiling
  against the optional dep.

## Gateway Modules

- `Mailglass.OptionalDeps.Oban` — gates `{:oban, "~> 2.21"}`. Fallback for
  `deliver_later/2` is `Task.Supervisor` (lands ).
- `Mailglass.OptionalDeps.OpenTelemetry` — gates `{:opentelemetry, "~> 1.7"}`.
  Adopter-owned bridge via `opentelemetry_telemetry`.
- `Mailglass.OptionalDeps.Mjml` — gates `{:mjml, "~> 6.0"}` (Rust NIF). Used
  by `Mailglass.TemplateEngine.MJML` when adopters opt into MJML.
- `Mailglass.OptionalDeps.GenSmtp` — gates `{:gen_smtp, "~> 1.3"}`. Used by
  `mailglass_inbound` for SMTP relay ingress (v0.5+).

## Lint Enforcement

 ships a custom Credo check (`NoBareOptionalDepReference`) that flags
any direct reference to the gated modules outside their corresponding
gateway module. The gateway is the single authorized callsite.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
