Metadata-Version: 2.4
Name: sendcraft-sdk
Version: 1.0.0
Summary: Official SendCraft SDK for Python - Send transactional emails and campaigns via the SendCraft API
Home-page: https://sendcraft.online
Author: SendCraft Team
Author-email: support@sendcraft.online
Keywords: sendcraft,email,transactional,marketing,api,sdk
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Communications :: Email
Classifier: Development Status :: 5 - Production/Stable
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.9; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# SendCraft Python SDK

Official Python SDK for [SendCraft](https://sendcraft.online) — send transactional emails and campaigns via the SendCraft API.

## Installation

```bash
pip install sendcraft-sdk
```

## Quick Start

```python
import os
from sendcraft import SendCraft

client = SendCraft(api_key=os.environ["SENDCRAFT_API_KEY"])

result = client.send_email(
    to_email="user@example.com",
    subject="Hello from SendCraft",
    html_content="<h1>Hello!</h1><p>Welcome!</p>",
    from_email="noreply@yourdomain.com"
)

print(result)
```

## Environment Variables

```env
SENDCRAFT_API_KEY=sk_live_your_key_here
```

## Usage Examples

### Send Bulk Emails

```python
client.send_bulk_emails(
    emails=[
        {"toEmail": "user1@example.com", "toName": "John"},
        {"toEmail": "user2@example.com", "toName": "Jane"},
    ],
    subject="Weekly Newsletter",
    html_content="<h1>This week...</h1>",
    from_email="newsletter@yourdomain.com"
)
```

### Create Campaign

```python
client.create_campaign(
    name="Product Launch",
    subject="Big News!",
    html_content="<h1>Check it out!</h1>",
    from_email="marketing@yourdomain.com",
    recipients=["user1@example.com", "user2@example.com"]
)
```

### Error Handling

```python
from sendcraft import SendCraft, SendCraftError, UnauthorizedError, RateLimitError

try:
    client.send_email(...)
except UnauthorizedError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests")
except SendCraftError as e:
    print("Error:", e)
```

## API Reference

| Method | Description |
|--------|-------------|
| `send_email(...)` | Send a single email |
| `send_bulk_emails(...)` | Send to multiple recipients |
| `schedule_email(...)` | Schedule email for later |
| `get_email_stats()` | Get email statistics |
| `create_campaign(...)` | Create campaign |
| `get_campaigns(limit)` | List campaigns |
| `send_campaign(id)` | Send campaign |
| `create_template(...)` | Create template |
| `get_templates()` | List templates |
| `create_webhook(...)` | Create webhook |
| `get_analytics(id)` | Campaign analytics |
| `get_account()` | Account info |

## Support

- Website: https://sendcraft.online
- Email: support@sendcraft.online

## License

MIT
