> For the complete documentation index, see [llms.txt](https://devise-token-auth.gitbook.io/devise-token-auth/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devise-token-auth.gitbook.io/devise-token-auth/config/email_auth.md).

# Email Authentication

If you wish to use email authentication, you must configure your Rails application to send email. [Read here](http://guides.rubyonrails.org/action_mailer_basics.html) for more information.

I recommend using [mailcatcher](https://mailcatcher.me/) for development.

#### mailcatcher development example configuration:

```ruby
# config/environments/development.rb
Rails.application.configure do
  config.action_mailer.default_url_options = { host: 'your-dev-host.dev' }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = { address: 'your-dev-host.dev', port: 1025 }
end
```

You also may want to configure `mail_sender` at devise initializer if you don't use your own mailer class

#### devise configuration:

```ruby
# config/initializers/devise.rb
Devise.setup do |config|
  config.mailer_sender = "example@example.com"
end
```

If you wish to send custom e-mails instead of using the default devise templates, you can [do that too](/devise-token-auth/usage/overrides.md#email-template-overrides).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://devise-token-auth.gitbook.io/devise-token-auth/config/email_auth.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
