# Python से ट्रांज़ैक्शनल ईमेल भेजें

> Sendtern SDK की मदद से Python से ट्रांज़ैक्शनल ईमेल भेजें। Email Playground में जाँचें और ईमेल ID से वास्तविक डिलीवरी ट्रैक करें।

## पूर्व आवश्यकताएँ

- एक Sendtern [API कुंजी](https://sendtern.com/hi/docs/authentication) `SENDTERN_API_KEY` के रूप में भंडारित
- Python 3.9 या नया संस्करण

1. **SDK इंस्टॉल करें**: अपने प्रोजेक्ट में यह कमांड चलाएँ।

```
python -m pip install https://github.com/Sendtern/sendtern-sdks/releases/download/v0.3.0/sendtern-0.3.0-py3-none-any.whl
```

2. **ईमेल भेजें**: `send.py` बनाएँ और उसे `python send.py` से चलाएँ।

```
import os
from sendtern import Sendtern

client = Sendtern(os.environ["SENDTERN_API_KEY"])
result = client.emails.send({
  "from": "Acme <hello@mail.example.com>",
  "to": "you@example.com",
  "subject": "Welcome to Acme",
  "text": "Thanks for signing up."
})
print(result["id"])
```

3. **जवाब जाँचें**: एक सफल निवेदन ईमेल आईडी के साथ `200 OK` लौटाता है. ईमेल को बाद में देखने के लिए इसका उपयोग करें.

```
{
  "id": "47be30ca-24b7-48fb-b35d-ff287b89e66d"
}
```

## भेजे बिना जाँचें

उदाहरण को `preview.py` के रूप में सहेजें और `python preview.py` चलाएँ। भेजने वाला डोमेन सेट करने से पहले [Email Playground](https://sendtern.com/hi/dashboard/playground) में संदेश और उसके हेडर जाँचें।

```
import os
from sendtern import Sendtern

client = Sendtern(os.environ["SENDTERN_API_KEY"])
result = client.emails.capture({
  "from": "sandbox@sendtern.test",
  "to": "recipient@example.com",
  "subject": "Welcome email preview",
  "html": "<p>Thanks for signing up.</p>"
})
print(result["id"])
```

वास्तविक ईमेल के लिए लौटाई गई ID से [डिलीवरी इवेंट देखें](https://sendtern.com/hi/docs/statuses)। मासिक भेजने की सीमाएँ [ट्रांज़ैक्शनल ईमेल प्लान](https://sendtern.com/hi/pricing) में देखें।

> **tip:** उदाहरण प्रेषक को अपने [सत्यापित डोमेन](https://sendtern.com/hi/docs/domains) पर एक पता के साथ बदलें.
