# Email delivery

Backends in your projects send email through a mail account that you store for the organization, either as a Mailtrap connection or as a generic SMTP account.

> Source: https://www.application-platform.com/en/docs/email-delivery/

Backends send mail through a **mail account** that you store for the organization under **Connections**; the two connection types appear together in projects in the **Mail account** picker.

## Mailtrap or generic SMTP

**Mailtrap** is the recommended option. You store only an API token and, optionally, a sender name and sender address; the platform sends through the Sending API and shows status, plan, sending volume, and your sending domains with DNS checks in the detail view, where you also create new sending domains.

**Email (SMTP)** is a generic SMTP account with **host**, **port**, **username**, **password** or **API key**, **sender address**, and **sender name** for any other provider and for Mailtrap as an SMTP relay.

[SMTP, IMAP and co.]({{< relref "email-protocols-smtp-imap" >}}) explains how SMTP differs from IMAP and POP3.

## Flow with Mailtrap

1. Create a Sending API token at [mailtrap.io](https://mailtrap.io/), as described under [SMTP with Mailtrap]({{< relref "smtp-mailtrap-setup" >}}).
2. Under **Connections**, use the **Mailtrap** tile to create a connection with that token.
3. Verify your sending domain with the DNS records from the connection's detail view.
4. Select the connection in the project as the **Mail account**; the generated backend reads the credentials from its configuration and sends through Mailtrap.

## Flow with generic SMTP

1. Create an account with your email provider and note the host, port, username, and password.
2. Under **Connections**, use the **Email (SMTP)** tile to create an entry with those values plus the sender address and sender name.
3. Select the connection in the project as the **Mail account**.

Locally, `ap run-local` also starts Mailhog for backends, which shows outgoing mail in the browser.

## Keep credentials narrow

Use API keys, tokens, or app passwords from the provider instead of your personal login, and restrict the account's permissions to sending.

