# ईमेल भेजें

> वितरण के लिए एक ट्रांजेक्शनल ईमेल कतारबद्ध करें.

`POST /emails`

Accepts the email and returns HTTP 200 with its ID. Delivery happens asynchronously; follow it with [Retrieve email](https://sendtern.com/docs/api-get-email). Send an `Idempotency-Key` header to retry safely.

## बॉडी पैरामीटर

- `from` (string, required): प्रेषक पता. एक मित्रवत नाम के लिए `Name <address>` का प्रयोग करें. डोमेन को सत्यापित किया जाना चाहिए.
- `to` (string | string[], required): 50 से अधिक के लिए प्राप्तकर्ता पता, या एक एरे.
- `subject` (string, required): ईमेल विषय, 500 अक्षर तक.
- `html` (string): एचटीएमएल बॉडी. ज़रूरी जब तक `text` सेट नहीं है.
- `text` (string): सादा पाठ मुख्य भाग. पाठ, एचटीएमएल, या प्रकाशित टैम्प्लेट प्रदान करें.
- `cc` (string | string[]): नक़ल प्राप्तकर्ता. 50 प्राप्तकर्ता सीमा के लिए गिनें.
- `bcc` (string | string[]): गुप्त नक़ल प्राप्तकर्ता. 50 प्राप्तकर्ता सीमा के लिए गिनें.
- `reply_to` (string | string[]): जहाँ से वे लाहौर चले गए।
- `tags` (object[]): इसका नाम और मूल्य दस वस्तुओं तक होता है।
- `template` (object): एक प्रकाशित टैम्प्लेट आईडी या उपनाम तथा वैकल्पिक वेरिएबल.

## शीर्षक

- `Idempotency-Key` (string): 256 अक्षर तक. देखें [Idempotency keys](https://sendtern.com/docs/idempotency).

## Example

cURL

```
curl -X POST 'https://sendtern.com/emails' \
  -H 'Authorization: Bearer st_your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{
  "from": "Acme <hello@mail.acme.io>",
  "to": [
    "ada@example.com"
  ],
  "subject": "Your sign-in code",
  "html": "<p>482 913</p>",
  "tags": [
    {
      "name": "category",
      "value": "auth"
    }
  ]
}'
```

Node.js

```
const res = await fetch("https://sendtern.com/emails", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SENDTERN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "from": "Acme <hello@mail.acme.io>",
    "to": [
      "ada@example.com"
    ],
    "subject": "Your sign-in code",
    "html": "<p>482 913</p>",
    "tags": [
      {
        "name": "category",
        "value": "auth"
      }
    ]
  }),
});

const data = await res.json();
```

Python

```
import os
import requests

res = requests.post(
    "https://sendtern.com/emails",
    headers={"Authorization": f"Bearer {os.environ['SENDTERN_API_KEY']}"},
    json={
      "from": "Acme <hello@mail.acme.io>",
      "to": [
        "ada@example.com"
      ],
      "subject": "Your sign-in code",
      "html": "<p>482 913</p>",
      "tags": [
        {
          "name": "category",
          "value": "auth"
        }
      ]
    },
)

print(res.json())
```

## Response

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