> For the complete documentation index, see [llms.txt](https://docs.qubitro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.qubitro.com/platform/functions/rule-function/send-email.md).

# Send Email

The Send Email action in Qubitro Rule Functions allows you to trigger emails based on data conditions from your devices.

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
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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
