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

# Sending Bulk Emails

## Sending Bulk Emails (Merchant to Global-e)

Emails can now be sent to multiple addresses by issuing an API call providing order IDs and the email message type. Additionally, placeholders can be added to the mail message to dynamically add details to the email message content without code changes.

This API provides the following:

* Allow the merchant to send CS emails (Bulk Emails) on a single API by providing a list of order IDs
* Allow the merchant to specify the email address for sending the processing report
* Allow merchant the option to specify the return address, default as configured for CS/FinOps
* Monitor and log merchant actions
* Store the action results report for performance and success level measurements.
* Customize the email message template for full merchant customizations and look & feel

**Prerequisites**

The following is to be prepared Before issuing the API:

* Select the **email type** and verify its template, from the existing types, or ask your CSM to create a template.
* Specify the **placeholders'** name and value, if you plan to add them to the email message.
* List the **Order ID**s that are the addressees of this mail.

**Method/URL**

```
POST https://{globale_api_domain}/emails
```

### Parameters

<Note>
  A text resource value refers to predefined placeholders and their related values. The placeholders and their values are defined in the Admin platform, with the prefix **TR\_**. A value can be a Global-e default value or merchant-specific value. Refer to your CSM for all predefined **TR\_** placeholders, and for defining merchant-specific values.
</Note>

| Name                   | Type                | Description                                                                                                                                                                              | Mandatory |
| ---------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| `emailTypeName`        | String              | Specifies the name of the email type and its related HTML template.                                                                                                                      | Yes       |
| `senderEmailAddress`   | String              | The mail address of the sender that the addressee sees. The default sender mail address is [DoNotReply@globle.com](mailto:DoNotReply@globle.com) orother mail specified by the merchant. | Yes       |
| `reportToEmailAddress` | String              | The merchant’s email address to receive the bulk sending report.                                                                                                                         | Yes       |
| `orderIds`             | Array of Strings    | The list of addressees, by their Order ID.                                                                                                                                               | Yes       |
| `Placeholders`         | List \<Placeholder> | A list of placeholders and their value source. Each Placeholder object contains:<br />Placeholder Name<br />Value – A fixed value or text resource value\*\*                             | No        |

### Return Codes

The returned error codes are as follows:

| Code | Description                                                                                                                                                                                                                                                                                                                                                                                 |   |
| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| 400  | The following descriptions can be returned:<br />"At least one order ID must be provided."<br />"The sender's email address is incorrect."<br />"The SenderEmailAddress must be a valid email address."<br />"The EmailTypeName must be provided."<br />"Custom email type is not defined. Please contact Global-E support."<br />"The ReportToEmailAddress must be a valid email address." |   |

### Email Examples

**Mail Message**

In the following example, the Order ID is integrated into the email template, by adding the **orderId**placeholder.

<Frame>
  <img src="https://mintcdn.com/globale-enterprise/vhiwVFSofQQTfWIF/images/uuid-9b8affa2-bedb-70ee-d6ab-f25f9cdc2ad9.png?fit=max&auto=format&n=vhiwVFSofQQTfWIF&q=85&s=af4ee0181297cd809ae9767550db6be5" width="1129" height="951" data-path="images/uuid-9b8affa2-bedb-70ee-d6ab-f25f9cdc2ad9.png" />
</Frame>

**Note**: When sending a list of Order IDs in the API request, each mail message will have the relevant ID for the mail recipient.

**Results Report Email**

The following report is received detailing the result of the bulk emails API, sent to inform of a delayed fulfillment of a single order ID.

<Frame>
  <img src="https://mintcdn.com/globale-enterprise/w-2f4DzByqA7m03j/images/uuid-3b45ac10-7a5c-471b-9e03-f12dc999d171.png?fit=max&auto=format&n=w-2f4DzByqA7m03j&q=85&s=0ece11c75da0e7afb6876b6d47b5c7db" width="1546" height="470" data-path="images/uuid-3b45ac10-7a5c-471b-9e03-f12dc999d171.png" />
</Frame>

### Example

**Request**

```
"orderIds": [
    "orderIds": [
           GE399999999GB""GE399999999GB"
     ],
],
"placeholders": {
     "placeholders": {
           "{DelayReason}": "TR_OverloadDelayReason",
           "{DelayReason}": "TR_OverloadDelayReason",
           "{DelayDaysCount}": "2",
           "senderEmailAddress": "globale@global-e.com",
           "emailTypeName": "Delayedfulfillment",
           "reportToEmailAddress": "zivido@gmail.com"
 }
}

```

**Response**

```
{
 "Processing is in progress. You will get an email after the process is complete."
}
```
