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

# SMTP users

> Create credentials for the Brudcast SMTP relay, connect your application, and regenerate or delete them safely.

export const Screenshot = ({id, src, srcDark, alt, caption}) => {
  if (!src) {
    return <Placeholder id={id} kind="screenshot" label="Screenshot coming soon" description={alt} icon={<ImageIcon />} />;
  }
  return <figure className="brd-media" data-media-id={id}>
      <img className="brd-media-frame block dark:hidden" src={src} alt={alt} />
      <img className="brd-media-frame hidden dark:block" src={srcDark || src} alt={alt} />
      {caption && <figcaption className="brd-media-caption">{caption}</figcaption>}
    </figure>;
};

Create a username and password your application can use to send mail through the Brudcast SMTP
relay.

<Screenshot id="ss-email-smtp-users-hero-smtp-tab" alt="A sending domain's SMTP Credentials tab listing SMTP users with their description, username, creation date and Active status" />

An SMTP user belongs to one sending domain. Use one when your application already sends mail over
SMTP and you'd rather not rewrite it against the [send API](/developers/sending/http-api).

<Info>
  **Before you start:** you need a sending domain of your own. SMTP isn't available on the managed
  sending address. Verify the domain before you send, or receiving servers can't authenticate your
  mail.
</Info>

## Create an SMTP user

<Steps>
  <Step title="Open the domain's SMTP Credentials tab">
    Go to **Channels > Email**, open the **Domains** tab, select the domain, then select the
    **SMTP Credentials** tab.
  </Step>

  <Step title="Add a user">
    Select **Add New SMTP User**. In **Description**, say where it will be used, for example
    `Billing app, production`. The description is optional. Select **Create**.
  </Step>

  <Step title="Copy the username and password">
    The **SMTP User Created** dialog shows the **SMTP Username** and **SMTP Password**. The password
    is shown once. Copy both into your application's secret store, then select **Done**.

    <Screenshot id="ss-email-smtp-users-01-created-dialog" alt="The SMTP User Created dialog showing the SMTP Username and a masked SMTP Password with copy buttons and a warning that the password is shown only once" />
  </Step>
</Steps>

The new user shows **Provisioning** for a few seconds, then **Active**. **Failed** means it couldn't be
set up. Delete it and create another.

Brudcast generates the username. It looks like an email address on your domain, for example
`3f9a1c7e@mail.example.com`, but it isn't a mailbox. Use it exactly as shown. The password is 32
characters long.

## Connection settings

| Setting        | Value                                                                 |
| -------------- | --------------------------------------------------------------------- |
| Host           | `out-smtp.prod.brudcast.com`                                          |
| Port           | `465` with TLS from the start, or `587`, `2525` or `25` with STARTTLS |
| Authentication | `PLAIN` or `LOGIN`                                                    |
| Username       | The SMTP username from the dialog                                     |
| Password       | The SMTP password from the dialog                                     |

On ports 587, 2525 and 25, your client must send STARTTLS before it logs in. If it tries to log in
first, it gets `538 Must issue a STARTTLS command first`. Use port 2525 if your network blocks 587.

Worked examples per language are in [SMTP relay](/developers/sending/smtp-relay).

## Rules and limits

* **The from domain must match.** The MAIL FROM address must be on the SMTP user's domain. A user on
  `mail.example.com` can't send as `hello@other.example.com`.
* **25 MB per message**, attachments included.
* **A message without a subject** goes out as `(no subject)`.
* **The relay rebuilds your message** from its From, To, Cc, subject, text, HTML and attachments.
  That means:
  * Recipients given only in the SMTP envelope (Bcc) **don't receive the message**. Put every
    recipient in To or Cc, or use the send API, which supports `bcc`.
  * `Reply-To` and custom headers are **dropped**. Use the send API if you need them.
* **Rate limits count once per SMTP transaction**, however many recipients it has.
* **One user per application.** You can then revoke one application's access without an outage
  everywhere else.

## Regenerate a password

On the user's row, open the **More actions** menu (the three-dot icon) and select
**Regenerate Password**, then **Regenerate**. The **Password
Regenerated** dialog shows the new password once. The old password stops working as soon as the new
one is active, so update your application straight away.

## Delete a user

On the user's row, open the **More actions** menu (the three-dot icon) and select **Delete**.
Anything still using those credentials fails on its next
connection. Check where the user is deployed before you remove it.

## SMTP or the send API

|                               | SMTP relay                                 | Send API                  |
| ----------------------------- | ------------------------------------------ | ------------------------- |
| Integration effort            | None if your app already sends mail        | One HTTP call             |
| Bcc, Reply-To, custom headers | Not supported                              | Supported                 |
| Maximum size                  | 25 MB per message                          | 10 MB request body        |
| Feedback                      | SMTP reply codes                           | A `jobId` you can look up |
| Best for                      | Existing apps and frameworks with a mailer | New integrations          |

## Related

<Columns cols={2}>
  <Card title="SMTP relay" icon="server" href="/developers/sending/smtp-relay">
    Code samples and protocol details.
  </Card>

  <Card title="Sending keys" icon="key-round" href="/channels/email/domain-api-keys">
    Credentials for the send API.
  </Card>

  <Card title="Email troubleshooting" icon="life-buoy" href="/channels/email/troubleshooting">
    SMTP error replies explained.
  </Card>
</Columns>
