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

# Sending Emails via SparkPost

> Send emails through SparkPost using the SendPost API with IP Pool routing.

Once your SparkPost provider and IP Pool are configured, you can send emails through SparkPost using the standard SendPost API.

<Note>
  **Important**: You must include the `ippool` parameter in your API request to route emails through SparkPost.
</Note>

***

## Basic Email Example

```bash theme={null}
curl -X POST "https://api.sendpost.io/api/v1/subaccount/email/" \
  -H "X-SubAccount-ApiKey: YOUR_SENDPOST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "email": "sender@yourdomain.com",
      "name": "Your Name"
    },
    "to": [{
      "email": "recipient@example.com",
      "name": "Recipient Name"
    }],
    "subject": "Hello from SendPost via SparkPost",
    "htmlBody": "<h1>Hello!</h1><p>This email is sent through SparkPost.</p>",
    "textBody": "Hello! This email is sent through SparkPost.",
    "ippool": "sparkpost-pool",
    "trackOpens": true,
    "trackClicks": true
  }'
```

***

## Email with Personalization

```bash theme={null}
curl -X POST "https://api.sendpost.io/api/v1/subaccount/email/" \
  -H "X-SubAccount-ApiKey: YOUR_SENDPOST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "email": "sender@yourdomain.com",
      "name": "Your Company"
    },
    "to": [{
      "email": "john@example.com",
      "name": "John Doe",
      "customFields": {
        "firstName": "John",
        "accountType": "Premium"
      }
    }],
    "subject": "Welcome {{firstName}}!",
    "htmlBody": "<h1>Welcome {{firstName}}!</h1><p>Your {{accountType}} account is ready.</p>",
    "ippool": "sparkpost-pool",
    "trackOpens": true,
    "trackClicks": true
  }'
```

***

## Response

**Success Response** (HTTP 200):

```json theme={null}
[
  {
    "messageId": "abc123-def456-ghi789",
    "errorCode": 0,
    "to": "recipient@example.com"
  }
]
```

***

## Next Steps

* [Understand event types](/guides/sparkpost/event-types) for tracking email status
* [View analytics](/guides/sparkpost/analytics) for your SparkPost emails
* [Troubleshoot issues](/guides/sparkpost/troubleshooting) if you encounter problems
