# Quickstart

MarleyFetch sends email through an SMTP account you already own. You tell it how to log in to
that account once, then send with one HTTPS request from anywhere — no SMTP library, no open
sockets.

You need about five minutes and the SMTP login for the address you want to send from.

## 1. Sign in

Go to [app.marleyfetch.com](https://app.marleyfetch.com) and sign in with Google. Signing in
only identifies you; it does not give MarleyFetch access to your mailbox.

## 2. Add an SMTP connection

Open **[Connections](https://app.marleyfetch.com/connections) → Add SMTP Connection**, pick your
provider and enter the address and password.

- **Gmail and Google Workspace** need an [App Password](https://myaccount.google.com/apppasswords),
  not your normal password. Turn on 2-Step Verification first.
- **Microsoft 365 / Outlook, Yahoo, iCloud, Zoho** also need an app password or SMTP AUTH enabled.
- **SES, SendGrid, Brevo** use the SMTP credentials from their console.

MarleyFetch tests the login before saving, so a wrong password fails here rather than on your
first send. See [SMTP connections](https://docs.marleyfetch.com/guides/connections.md) for every provider's settings.

## 3. Create an API key

Open **[API Keys](https://app.marleyfetch.com/tokens) → Create Key**. Copy the key — it starts with
`mf_live_` and is shown only once.

Store it as an environment variable, never in source control:

```bash
export MARLEYFETCH_API_KEY="mf_live_..."
```

## 4. Send an email

Replace `you@yourcompany.com` with the address you connected and `you@example.com` with where
the test should go.

::: code-group

```bash [cURL]
curl https://api.marleyfetch.com/v1/send \
  -H "Authorization: Bearer $MARLEYFETCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "you@yourcompany.com",
    "to": "you@example.com",
    "subject": "Hello from MarleyFetch",
    "text_body": "It works."
  }'
```

```ts [SDK]
// npm install @marleyfetch/sdk
import { MarleyFetch } from '@marleyfetch/sdk'

const mf = new MarleyFetch({ apiKey: process.env.MARLEYFETCH_API_KEY })

await mf.from('you@yourcompany.com')
  .to('you@example.com')
  .subject('Hello from MarleyFetch')
  .text_body('It works.')
  .send()
```

```ts [fetch]
const res = await fetch('https://api.marleyfetch.com/v1/send', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MARLEYFETCH_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    from: 'you@yourcompany.com',
    to: 'you@example.com',
    subject: 'Hello from MarleyFetch',
    text_body: 'It works.',
  }),
})
console.log(res.status, await res.json())
```

```python [Python]
import os, requests

res = requests.post(
    "https://api.marleyfetch.com/v1/send",
    headers={"Authorization": f"Bearer {os.environ['MARLEYFETCH_API_KEY']}"},
    json={
        "from": "you@yourcompany.com",
        "to": "you@example.com",
        "subject": "Hello from MarleyFetch",
        "text_body": "It works.",
    },
)
print(res.status_code, res.json())
```

:::

A successful response looks like this:

```json
{
  "success": true,
  "messageId": "<send-4821@mid.marleyfetch.com>",
  "outboxId": 4821,
  "from": "you@yourcompany.com",
  "message": "Email sent successfully"
}
```

`from` is the address of the connection you added in step 2 — it picks which account sends.
Your first connection is also your default, so you could leave `from` out; keeping it means the
request still sends from the same address after you add more connections.

## 5. Check the outbox

Every send appears in the dashboard's **[Email Outbox](https://app.marleyfetch.com/outbox)** with
its status and any error from your SMTP server. With mailbox providers such as Gmail it also
shows up in your Sent folder, because it really was sent from your account.

## Next steps

- [Sending email](https://docs.marleyfetch.com/guides/sending.md) — recipients, HTML, idempotent retries and queued sends.
- [Batch sending](https://docs.marleyfetch.com/guides/batches.md) — one message to up to thousands of recipients.
- [Errors](https://docs.marleyfetch.com/reference/errors.md) — what each error code means and what to do about it.
- [API reference](https://docs.marleyfetch.com/api/index.md) — every endpoint and field.
