# Python ile işlemsel e-posta gönderin

> Sendtern SDK’sıyla Python’dan işlemsel e-posta gönderin. Email Playground’da test edin ve gerçek teslimatı e-posta kimliğiyle izleyin.

## Önkoşullar

- `SENDTERN_API_KEY` olarak depolanan bir Sendtern [API anahtarı](https://sendtern.com/tr/docs/authentication)
- Python 3.9 veya daha yeni bir sürüm

1. **SDK’yı kurun**: Bu komutu projenizde çalıştırın.

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

2. **E-posta gönder**: `send.py` dosyasını oluşturun ve `python send.py` ile çalıştırın.

```
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. **Cevapları kontrol et.**: Başarılı bir talep e-posta kimliğiyle `200 OK`'yi geri verir. Daha sonra e-postayı aramaya kullanın.

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

## Göndermeden test edin

Örneği `preview.py` olarak kaydedip `python preview.py` komutunu çalıştırın. Gönderen alan adını ayarlamadan önce [Email Playground](https://sendtern.com/tr/dashboard/playground) üzerinden iletiyi ve başlıklarını inceleyin.

```
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"])
```

Gerçek gönderim için dönen kimlikle [teslimat olaylarını kontrol edin](https://sendtern.com/tr/docs/statuses). Aylık sınırlar için [işlemsel e-posta planlarına](https://sendtern.com/tr/pricing) bakın.

> **tip:** Örnek göndericiyi [verilen alan adı](https://sendtern.com/tr/docs/domains) adresinizle değiştirin.
