> ## 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.

# Python SDK Quickstart

> Learn how to configure and send your first email with SendPost Python SDK

## Prerequisites

To get the most out of this guide, you'll need to:

* [**Create a SendPost Account**](https://app.sendpost.io/register)
* [**Install Python >v3.0**](https://www.python.org/downloads/)
* A **Sub-Account API Key** from your SendPost dashboard

<Info>
  You can find your API keys in your [SendPost
  Dashboard](https://app.sendpost.io). Make sure to use your Sub-Account API Key
  for sending emails.
</Info>

## 1. Install

```shellscript pip theme={null}
pip install sendpost_python_sdk
```

## 2. Getting Started

```python Python theme={null}
import os
import sendpost_python_sdk
from sendpost_python_sdk.api import EmailApi
from sendpost_python_sdk.models import EmailMessageObject, EmailAddress, Recipient

configuration = sendpost_python_sdk.Configuration(host="https://api.sendpost.io/api/v1")
configuration.api_key['subAccountAuth'] = "your_sub_account_api_key"

with sendpost_python_sdk.ApiClient(configuration) as api_client:
    email_message = EmailMessageObject()
    email_message.var_from = EmailAddress(email="richard@piedpiper.com")
    email_message.to = [Recipient(email="gavin@hooli.com")]
    email_message.subject = "Hello World"
    email_message.html_body = "<strong>it works!</strong>"
    
    try:
        response = EmailApi(api_client).send_email(email_message)[0]
        print(f"Email sent! Message ID: {response.message_id}")
    except sendpost_python_sdk.exceptions.ApiException as e:
        print(f"Error: {e.status} - {e.body}")
```

<Warning>
  Make sure your sender email domain is verified in your SendPost account before
  sending emails.
</Warning>

## 3. Next Steps

Explore more examples and use cases:

<Columns cols={3}>
  <Card title="Python SDK" icon="python" href="https://pypi.org/project/sendpost-python-sdk/">
    View the official SDK package on PyPI
  </Card>

  <Card title="SDK Examples" icon="github" href="https://github.com/sendpost/sendpost-examples-python">
    Comprehensive email sending examples
  </Card>

  <Card title="ESP Workflow Example" icon="diagram-project" href="https://github.com/sendpost/python-esp-example">
    Full-featured example app with comprehensive ESP workflow
  </Card>
</Columns>
