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

# Send Transactional Emails

> Set up email sending for your Hiveku app — welcome emails, password resets, receipts, and more

Transactional emails are the messages your app sends on behalf of your users: welcome emails, password resets, order confirmations, and so on. Hiveku gives you two ways to send them.

<CardGroup cols={2}>
  <Card title="Hiveku Email" icon="envelope">
    Built-in, integrated, no extra account needed
  </Card>

  <Card title="Bring your own" icon="plug">
    Resend, SendGrid, or Postmark via env vars
  </Card>
</CardGroup>

## Option 1: Hiveku Email (Recommended)

Hiveku Email is integrated directly into your project — no separate billing, no extra dashboard to learn.

<Steps>
  <Step title="Create an API key">
    Go to **Settings > Email > API Keys** and click **Create**.

    Create two keys:

    * **Test key** — use in development. Emails go to a sandbox inbox and aren't delivered to real recipients.
    * **Live key** — use in production. Emails go to real inboxes.

    <Warning>
      Copy the key immediately. It's only shown once — after you close the dialog, only a masked preview remains.
    </Warning>
  </Step>

  <Step title="Verify a sending domain">
    Go to **Settings > Email > Domains** and click **Add Domain**.

    Enter the domain you want to send from (e.g., `yourcompany.com`). Hiveku shows you the DNS records to add at your registrar:

    * **DKIM** — proves the email is really from you
    * **SPF** — lists who's allowed to send on your behalf
    * **DMARC** — policy for what to do if SPF/DKIM fail

    Add the records, then click **Verify**. DNS usually propagates within a few minutes — up to 48 hours in rare cases.

    <Info>
      You can only send from addresses on verified domains. The `from` address must match (e.g., `hello@yourcompany.com`).
    </Info>
  </Step>

  <Step title="Install the SDK">
    In your project's code editor, install the Hiveku email package:

    ```bash theme={null}
    npm install @hiveku-apps/email
    ```
  </Step>

  <Step title="Send your first email">
    ```ts theme={null}
    import { Hiveku } from "@hiveku-apps/email";

    const hiveku = new Hiveku(process.env.HIVEKU_EMAIL_API_KEY);

    await hiveku.emails.send({
      from: "hello@yourcompany.com",
      to: "customer@example.com",
      subject: "Welcome aboard",
      html: "<p>Thanks for signing up!</p>",
    });
    ```

    Store your API key in an environment variable — never hardcode it.
  </Step>

  <Step title="Deploy">
    Deploy your project. Your app is now sending real email.
  </Step>
</Steps>

<Tip>
  For the full API reference (attachments, templates, batch send, webhooks), see [/email/quickstart](/email/quickstart) and [/email/domains](/email/domains).
</Tip>

## Option 2: Bring Your Own Provider

If you already have a Resend, SendGrid, or Postmark account, plug it in via environment variables.

<Steps>
  <Step title="Grab your provider's API key">
    * **Resend** — `resend.com/api-keys`
    * **SendGrid** — Settings > API Keys
    * **Postmark** — Servers > API Tokens
  </Step>

  <Step title="Add it to your Hiveku project">
    In your project's **Settings > Environment Variables**, add:

    ```
    RESEND_API_KEY=re_...
    ```

    (or the equivalent for your provider)
  </Step>

  <Step title="Install the provider SDK and send">
    ```bash theme={null}
    npm install resend
    ```

    ```ts theme={null}
    import { Resend } from "resend";

    const resend = new Resend(process.env.RESEND_API_KEY);

    await resend.emails.send({
      from: "hello@yourcompany.com",
      to: "customer@example.com",
      subject: "Welcome aboard",
      html: "<p>Thanks for signing up!</p>",
    });
    ```
  </Step>
</Steps>

## Verifying It Works

Send a test email to yourself, then check **Settings > Email > Analytics** (for Hiveku Email) or your provider's dashboard. You should see the event within seconds — delivered, opened, clicked, bounced, or complained.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Domain not verified">
    DNS records are probably wrong or haven't propagated. Double-check each record against what Hiveku showed you — watch for trailing dots, quotes, and the exact selector name. Use a tool like `dig TXT default._domainkey.yourcompany.com` to confirm the record is live, then click **Verify** again.
  </Accordion>

  <Accordion title="Recipient is on the suppression list">
    If a recipient bounced or marked a previous email as spam, they're added to your account suppression list. Check **Settings > Email > Suppressions**, remove the address if appropriate, and try again.
  </Accordion>

  <Accordion title="Rate limit exceeded">
    Hiveku Email defaults to 10 sends per second. For higher volume, ask support to raise the limit, or batch sends with small delays.
  </Accordion>

  <Accordion title="Test emails aren't arriving">
    Test keys route to a sandbox inbox and never leave Hiveku. To send to a real inbox, switch to your live key.
  </Accordion>
</AccordionGroup>

## What's Next?

<CardGroup cols={2}>
  <Card title="Email Reference" icon="book" href="/email/quickstart">
    Full API reference, templates, webhooks, batch sending
  </Card>

  <Card title="Domain Setup" icon="globe" href="/email/domains">
    Deep dive on DKIM, SPF, DMARC, and deliverability
  </Card>
</CardGroup>
