# Send Email

The **Send Email** action in [Rule Functions](https://docs.qubitro.com/platform/functions/rule-function) 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**](https://docs.qubitro.com/add-ons/managed-email) to be enabled in your organization's[ add-on settings.](https://docs.qubitro.com/organizations/add-ons)
{% 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**](https://docs.qubitro.com/platform/functions/rule-function/..#javascript-logic-builder) or [**Visual Condition Builder**](https://docs.qubitro.com/platform/functions/rule-function/..#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>
