> For the complete documentation index, see [llms.txt](https://www.docpartner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.docpartner.dev/en/api/mail-partner/single-send.md).

# Single Email Send

This request is used to send emails in real time or scheduled.

## URL

<mark style="color:green;">`POST`</mark> `https://api.mailpartner.fr/v1/send`

{% hint style="warning" %}
The platform does not send commercial emails between **8 PM and 8 AM on weekdays and on Sundays and public holidays** (legal restriction). If a commercial email is sent, the message is **paused until the next working day at 8 AM**.\
Not sending commercial emails? Contact us to disable this restriction: <help@mailpartner.fr>
{% endhint %}

#### **Required Parameters**

<table data-full-width="false"><thead><tr><th width="180">Name</th><th>Value</th></tr></thead><tbody><tr><td><code>apiKey</code></td><td><a href="https://my.mailpartner.fr/dashboard/api">Your API key</a></td></tr><tr><td><code>subject</code></td><td>Email subject</td></tr><tr><td><code>htmlContent</code></td><td><p>HTML content of the email.</p><p>The <code>#READ_ONLINE#</code> tag adds the link "If this email does not display correctly, please use the following link:"<br>The <code>#UNSUBSCRIBE_LINK#</code> tag adds the unsubscribe link</p></td></tr><tr><td><code>From</code></td><td>Sender email address of the send<br>email: email<br>name (optional): Name</td></tr><tr><td><code>to</code></td><td>You can add up to 500 recipients:</td></tr></tbody></table>

| `email`           | Recipient's email |
| ----------------- | ----------------- |
| `name` (optional) | Recipient's name  |

#### **Optional Parameters**

<table><thead><tr><th width="262">Name</th><th>Value</th></tr></thead><tbody><tr><td><code>replyTo</code></td><td></td></tr><tr><td><code>variables</code></td><td>You can add <strong>up to 8 custom variables</strong> containing text only (no HTML).<br>Ex:<br><code>"variables":{"firstname":"John", "lastname": "Doe"}</code>These variables must be added in the <strong>template</strong> or in <strong>htmlContent</strong> like this: <strong>#FIRSTNAME#</strong> and <strong>#LASTNAME#</strong></td></tr><tr><td><code>attachments</code></td><td><p>3 attachments maximum. 5MB per attachment.</p><p><code>base64Content</code>: The content must be Base64-encoded. You must also specify the MIME type and a file name.</p><p><code>filename</code>: Attachment name (without extension)</p><p><code>contentType</code> <strong>:</strong> MIME type of the attachment.</p><p>You can see the official list of MIME types <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">here</a>.<br>For the content, you can find an online Base64 encoder – for example <a href="https://www.freeformatter.com/base64-encoder.html">here</a>. Once the file is encoded, use the resulting string as the value of Base64Content.</p><p><strong>Full JSON example:</strong></p><pre class="language-json"><code class="lang-json">{
  "attachments": [
    {
      "base64Content": "VGhpcyBpcyB5b3VyIGF0dGFjaGVkIGZpbGUhISEK",
      "contentType": "text/plain",
      "filename": "test"
    }
  ]
}
</code></pre></td></tr><tr><td><code>tag</code></td><td>Lowercase identifier (no spaces) between 3 and 20 characters</td></tr><tr><td><code>scheduledDeliveryDate</code></td><td>Scheduled send date of the email, in <code>dd/mm/YYYY</code> format. Only set this if you want the emails to be sent later.</td></tr><tr><td><code>time</code></td><td>Send time of the email (0-24 format), required if <code>scheduledDeliveryDate</code> is set.</td></tr><tr><td><code>minute</code></td><td>Send minute of the email (0-55 format, in five-minute intervals), required if <code>scheduledDeliveryDate</code> is set.</td></tr><tr><td><code>sandbox</code></td><td><p><code>1</code> for Sandbox mode</p><div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>No email will be sent, and there will be no charge on your account. These emails are automatically removed from your sending lists every day.</p></div></td></tr><tr><td><code>_format</code></td><td><code>json</code> or <code>xml</code></td></tr></tbody></table>

| `email`           | Email |
| ----------------- | ----- |
| `name` (optional) | Name  |

#### Request

{% tabs %}
{% tab title="PHP" %}

<pre class="language-php"><code class="lang-php">&#x3C;?php
        // Prepare data for POST request
        $jsonParams = "{
       "apiKey": "Your API kEY",
       "subject": "My email's subject",
       "sandbox":0,
       "htmlContent": "My first &#x3C;strong>email&#x3C;/strong>",
       "scheduledDeliveryDate":"25/09/2020",
       "time":"12",
       "minute":"00",
       "from": {
          "name" :"Marie",
          "email": "myemail@email.com"    
       },
       "to": [
          {
              "email": "email1"
<strong>          },
</strong>          {
              "emai": "email2"
          }
        ]
       }"
 
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL,'http://api.mailpartner.fr/v1/send');
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonParams);
 
        $result = curl_exec($curl);
        curl_close($curl);
 
        // Process your response here
        echo $result;
?>
</code></pre>

{% endtab %}
{% endtabs %}

#### **Response**

{% tabs %}
{% tab title="json" %}

```json
{
    "success": true,
    "code": 200,
    "messageId": "xxx",
    "nbMail": 1,
    "cost": 1,
    "currency": "EUR",
    "scheduledDeliveryDate": "2020-09-25 12:00:00"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.docpartner.dev/en/api/mail-partner/single-send.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
