# 이메일 보내기

> 전송을 위해 트랜잭션 이메일을 대기열에 넣습니다.

`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): HTML 본문. `text`가 설정되지 않은 경우 필수.
- `text` (string): 일반 텍스트 본문. 텍스트, HTML 또는 게시된 템플릿을 제공합니다.
- `cc` (string | string[]): 복사 받는 사람. 50명 수신자 한도를 향해 세어보십시오.
- `bcc` (string | string[]): 암호화된 복사본 수신자. 50명 수신자 한도를 향해 세십시오.
- `reply_to` (string | string[]): 답변이 갈 곳이야
- `tags` (object[]): 이름과 값을 포함하는 최대 10개의 개체.
- `template` (object): 게시된 템플릿 ID 또는 별칭과 선택적 변수.

## 머릿말

- `Idempotency-Key` (string): 최대 256자. [동일한 키](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"
}
```
