# Send Your First Email

Send a transactional email from your app with one API call. You need an Inboxjot workspace and access to the DNS settings of the domain you send from.

```bash cURL
curl -X POST https://api.inboxjot.com/v1/emails \
  -H "Authorization: Bearer $INBOXJOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <hello@acme.dev>",
    "to": "riti@example.com",
    "subject": "Your receipt from Acme",
    "html": "<p>Thanks for your order.</p>"
  }'
```

```javascript Node.js
import { Inboxjot } from 'inboxjot';

const inboxjot = new Inboxjot();

const { id } = await inboxjot.emails.send({
  from: 'Acme <hello@acme.dev>',
  to: 'riti@example.com',
  subject: 'Your receipt from Acme',
  html: '<p>Thanks for your order.</p>',
});
```

```rust Rust
use inboxjot::{Inboxjot, SendEmail};

let client = Inboxjot::from_env()?;

let email = client
    .emails()
    .send(&SendEmail {
        from: Some("Acme <hello@acme.dev>".into()),
        to: vec!["riti@example.com".into()],
        subject: Some("Your receipt from Acme".into()),
        html: Some("<p>Thanks for your order.</p>".into()),
        ..Default::default()
    })
    .await?;
```

```go Go
client := inboxjot.NewClient("")

email, err := client.Emails.Send(ctx, inboxjot.SendEmailParams{
	From:    "Acme <hello@acme.dev>",
	To:      []string{"riti@example.com"},
	Subject: "Your receipt from Acme",
	HTML:    "<p>Thanks for your order.</p>",
})
```

```python Python
from inboxjot import Inboxjot

inboxjot = Inboxjot()

email = inboxjot.emails.send(
    {
        "from": "Acme <hello@acme.dev>",
        "to": "riti@example.com",
        "subject": "Your receipt from Acme",
        "html": "<p>Thanks for your order.</p>",
    }
)
```

## Create an API Key

In the dashboard, open API Keys and create a key with Sending access. Store it as `INBOXJOT_API_KEY`. You only see the key once.

```
INBOXJOT_API_KEY=ibx_8f2c…
```

## Verify a Domain

Open Domains, add the domain you send from and add the DNS records it shows. Verification usually takes a few minutes.

> The API refuses to send from a domain until it is verified. The sender address
> must use a verified domain of your workspace.

## Send an Email

Call `POST /v1/emails` with your key as a bearer token. Send html, text or both.

```bash cURL
curl -X POST https://api.inboxjot.com/v1/emails \
  -H "Authorization: Bearer $INBOXJOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <hello@acme.dev>",
    "to": "riti@example.com",
    "subject": "Your receipt from Acme",
    "html": "<p>Thanks for your order.</p>"
  }'
```

```javascript Node.js
import { Inboxjot } from 'inboxjot';

const inboxjot = new Inboxjot();

const { id } = await inboxjot.emails.send({
  from: 'Acme <hello@acme.dev>',
  to: 'riti@example.com',
  subject: 'Your receipt from Acme',
  html: '<p>Thanks for your order.</p>',
});
```

```rust Rust
use inboxjot::{Inboxjot, SendEmail};

let client = Inboxjot::from_env()?;

let email = client
    .emails()
    .send(&SendEmail {
        from: Some("Acme <hello@acme.dev>".into()),
        to: vec!["riti@example.com".into()],
        subject: Some("Your receipt from Acme".into()),
        html: Some("<p>Thanks for your order.</p>".into()),
        ..Default::default()
    })
    .await?;
```

```go Go
client := inboxjot.NewClient("")

email, err := client.Emails.Send(ctx, inboxjot.SendEmailParams{
	From:    "Acme <hello@acme.dev>",
	To:      []string{"riti@example.com"},
	Subject: "Your receipt from Acme",
	HTML:    "<p>Thanks for your order.</p>",
})
```

```python Python
from inboxjot import Inboxjot

inboxjot = Inboxjot()

email = inboxjot.emails.send(
    {
        "from": "Acme <hello@acme.dev>",
        "to": "riti@example.com",
        "subject": "Your receipt from Acme",
        "html": "<p>Thanks for your order.</p>",
    }
)
```

The API answers `202 Accepted` with the email id. Keep it to look the email up later.

## Check the Logs

Open Emails to see the delivery, opens and clicks. Every API request also shows in Logs with its response.
