# Send Email

The **Send Email** action in [Rule Functions](/platform/functions/rule-function.md) allows you to trigger emails based on data conditions from your devices. This feature is helpful for real-time alerts, notifications, and status updates.

Send Email is a fully-managed service and supports multiple recipients

{% hint style="warning" %}
The Send Email action requires the [**Managed Email Add-On**](/add-ons/managed-email.md) to be enabled in your organization's[ add-on settings.](/organizations/add-ons.md)
{% endhint %}

### When to Use

* Send alerts based on threshold breaches (e.g., temperature too high).
* Notify team members or customers about device statuses.
* Provide regular device data updates automatically.

### Configuration

{% stepper %}
{% step %}
**Configure Basics Settings**

* **Set Debounce period** *(optional)*: Choose a time frame during which repeated triggers will be ignored. This prevents excessive emails.
* **Enter Name**: Enter a unique, descriptive name for your function.
* **Provide Description**: Add details that help your team quickly understand the purpose of the function.
  {% endstep %}

{% step %}
**Configure Email Template**

Create dynamic email content using available placeholders:

* **Message**: Craft your email body using available placeholders:
  * `"${{data_key}}"`: Inserts the value from your device data (e.g., temperature, humidity).
  * `<%device_name%>`: Inserts the name of the triggering device.
  * `<%last_seen%>`: Inserts the last-seen timestamp of the device.

Example message:

```markdown
Alert: Last value from sensor: ${{temperature}}

Device: "<%device_name%>"

Qubitro Team
```

* **Subject**: Enter the email subject line clearly indicating the alert type.
* **Title**: Provide a short, clear title summarizing the email content.
* **Recipient**: Add one or more email addresses to receive the notification.
  {% endstep %}

{% step %}
**Condition Configuration**

* **Condition type**: Select [**JavaScript Logic Builder**](/platform/functions/rule-function.md#javascript-logic-builder) or [**Visual Condition Builder**](/platform/functions/rule-function.md#visual-condition-builder) to configure condition.

Example:

```javascript
function run(){
  let temperature = "${{temperature}}";

  if (temperature > 30){
    trigger();
  }
};
```

This logic sends an email if the temperature value exceeds 30.
{% endstep %}
{% endstepper %}

### Common Errors & Troubleshooting

<details>

<summary>Email not triggering</summary>

* Check JavaScript conditions for syntax errors.
* Verify that the debounce period isn't unintentionally blocking emails.

</details>

<details>

<summary>Incorrect data in emails</summary>

* Ensure placeholders exactly match your device's data keys.
* Confirm the data keys exist in your device's data payload.

</details>


---

# Agent Instructions: 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:

```
GET https://docs.qubitro.com/platform/functions/rule-function/send-email.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
