> ## Documentation Index
> Fetch the complete documentation index at: https://nestcrate.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# nestrs-mail API

> Reference for MailModule, MailService, MailMessage, render_template, and transports.

Crate: [`nestrs-mail`](https://docs.rs/nestrs-mail/1.7.1) · Feature: `mail` · Guide: [Mail](https://nestcrate.dev/ecosystem/mail.md)

```toml theme={null}
nestrs-mail = "1.7.1"
```

## `MailModule::register`

Exports `MailService`.

## `MailService`

```rust theme={null}
pub fn from_options(opts: &MailOptions) -> Self
pub async fn send(&self, message: MailMessage) -> Result<(), MailError>
pub fn transport(&self) -> SharedMailTransport
```

## `render_template`

```rust theme={null}
pub fn render_template(template: &str, data: &HashMap<String, String>) -> String
```

Replaces `{{key}}` with HTML-escaped values.

## `MailMessage`

`to`, `subject`, `html`, `idempotency_key: Option<String>`.

## `MailError`

`Transport(String)` (retryable) · `Permanent(String)` (`permanent() == true`).

## Transports

* `InMemoryMailTransport::new()` → `inbox()` / `clear()`
* `HttpMailTransport` behind feature `http`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.