> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shootmail.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Mail

> Send mails using the REST API endpoint

<a href="https://god.gw.postman.com/run-collection/107113-90886de7-13a6-4019-9de3-b8955cbceda7?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D107113-90886de7-13a6-4019-9de3-b8955cbceda7%26entityType%3Dcollection%26workspaceId%3D4cde4d2d-aa18-4f63-ba0a-a3b87f3fc48b" target="_blank">
  <img height="32" width="128" noZoom src="https://run.pstmn.io/button.svg" />
</a>

### Endpoint

```bash POST theme={null}
https://shootmail.app/api/mail/schedule
```

### Authorization

Send API key in the header, just the API key, nothing else. [Here is how to generate API Key](/api-keys)

```bash theme={null}
header: {
    'Authorization': 'shootmail-api-key',
    'Content-Type': 'application/json'
}
```

## Request

Request body should contain the following params

```json theme={null}
{
    from: { email: "hi@example.com" },
    provider: "resend", // or "zoho", "sendgrid", "postmark"
    apiKey: "mail-provider-api-key", //example: resend API key
    subject: "Shootmail is awesome!",
    templateId: "kthiazpqofgnrtm",
    to: [
        {
            email: "hi@example.com"    
        }
    ],
    bcc: "abc@example.com", //optional: can be string or string[]
    cc: "abc@example.com", //optional: can be string or string[]
    preHeader: "Shootmail is awesome!"
    params: {
        brand: {...},
        socialMedia: {...},
        variables: [{...}]
    }
}
```

### Sample request body

```json theme={null}
{
   "apiKey": "email-provider-api-key",
   "templateId":"kthiazpqofgnrtm",
   "from":{
      "name":"Shootmail",
      "email":"noreply@mail.shootmail.app"
   },
   "provider":"resend",
   "to":[
      {
         "email":"sps.1431990@gmail.com"
      }
   ],
   "subject":"Regarding your Shootmail subscription",
   "params" :{
    "brand": {
        "color": "#F6821F",
        "name": "ShootMail",
        "website": "https://shootmail.app",
        "logo": {
            "dark": "https://res.cloudinary.com/curead/image/upload/f_auto,q_auto/v1713876965/Shootmail/logos/shootm-logo-with-name-dark-mode_rziumz.png",
            "light": "https://res.cloudinary.com/curead/image/upload/c_scale,f_auto,q_auto,w_343/v1712843877/Shootmail/logos/shootm-logo-with-name_jgdq2l.png",
            "default": "https://res.cloudinary.com/curead/image/upload/c_scale,f_auto,q_auto,w_343/v1712843877/Shootmail/logos/shootm-logo-with-name_jgdq2l.png"
        },
        "support": {
            "email": "",
            "phone": "973456800000",
            "slack": "https://slack.com",
            "discord": "https://discord.com"
        }
    },
    "socialMedia": {
        "instagram": "https://shootmail.app",
        "x": "https://shootmail.app",
        "youTube": "https://shootmail.app",
        "meta": "https://shootmail.app",
        "linkedIn": "https://shootmail.app"
    },
    "variables": [
        {
            "type": "preHeader",
            "text": "Your discount code"
        },
        {
            "type": "circleIcon",
            "url": "https://res.cloudinary.com/curead/image/upload/f_auto/v1714753437/Shootmail/mocks/party-popper-emoji_bzpdz9.png",
            "size": 180,
            "bgOpacity": 20
        },
        {
            "type": "heading",
            "level": "1",
            "text": "You are in!",
            "align": "center"
        },
        {
            "type": "text",
            "text": "Welcome to ShootMail, we are excited to have you onboard.",
            "align": "center"
        },
        {
            "type": "alert",
            "heading": "Your invitation code",
            "text": "A8989NJNJNJ",
            "align": "center"
        },
        {
            "type": "text",
            "text": "Use this code to sign up on ShootMail",
            "align": "center"
        },
        {
            "type": "cta",
            "target": "https://shootmail.app",
            "text": "Join Shootmail",
            "align": "center"
        }
    ]
    }
}
```

### Response

Response will contain

Check [response format](/usage/response) section.
