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

# Email

> Configure Email integration for ChatbotX.

The Email feature allows you to turn any email address into a ChatbotX inbox. Incoming emails will be displayed as conversations, and your team can reply directly from ChatbotX using an SMTP connection to send notifications, order confirmations, documents, or automated email sequences.

<Warning>
  **Important note on Email Deliverability:**\
  To ensure your emails are not marked as Spam and achieve the highest delivery rate, make sure you have configured domain authentication (**SPF**, **DKIM**, and **DMARC**) in your sending domain's DNS manager before using it in a production environment.
</Warning>

<Info>
  If you do not have a dedicated SMTP provider yet, see the [Emails configuration guide](/configuration/emails) for recommended providers and connection string examples.
</Info>

Below is a guide from basic to advanced for setting up and using the Email sending feature in ChatbotX.

## Step 1: Get SMTP credentials from your provider

Depending on the Email service provider you are using, you will need the following basic information to connect with ChatbotX:

* **SMTP Host/Server**
* **SMTP Port** (Usually `465` for SSL or `587` for TLS)
* **SMTP Username** (Usually your email address)
* **SMTP Password** (App Password or API Key, **not your main account login password**)

<Frame>
  <img src="https://mintcdn.com/chatbotx/ki-zrl-4XwRESz1z/images/chatbotx-email-smtp-providers-overview-1.png?fit=max&auto=format&n=ki-zrl-4XwRESz1z&q=85&s=43d1054820328c8ec1c45bd899671078" alt="Overview of popular SMTP Email service providers" width="1024" height="576" data-path="images/chatbotx-email-smtp-providers-overview-1.png" />
</Frame>

Please expand (click) on your corresponding Email provider below to see how to get an App Password or SMTP Key.

<AccordionGroup>
  <Accordion title="1. Gmail / Google Workspace" icon="google">
    <Steps>
      <Step title="Enable 2-Step Verification">
        Log in to your Google account, go to the **Security** section, and make sure you have turned on **2-Step Verification**.
      </Step>

      <Step title="Create an App Password">
        Still in the **Security** section, find the **App passwords** section.
      </Step>

      <Step title="Get the password">
        Enter an app name (e.g., `ChatbotX SMTP`) and click **Create**. Google will provide you with a 16-letter string. This is your **SMTP Password**.
      </Step>

      <Step title="Connection parameters">
        * **Host:** `smtp.gmail.com`
        * **Port:** `465` (SSL) or `587` (TLS)
        * **Username:** Your Gmail address.

        <Note>
          See the official documentation for more details: [Sign in with App Passwords - Google Account Help](https://support.google.com/accounts/answer/185833)
        </Note>
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="2. Outlook / Office 365" icon="microsoft">
    <Steps>
      <Step title="Access security settings">
        Log in to your Microsoft account, go to **Security > Advanced Security Options**.
      </Step>

      <Step title="Create an App Password">
        Ensure **Two-step verification** is turned on. Then scroll down to the **App passwords** section and click **Create a new app password**.
      </Step>

      <Step title="Get the password">
        Save the newly created password. This is your **SMTP Password**.
      </Step>

      <Step title="Connection parameters">
        * **Host:** `smtp-mail.outlook.com` (or `smtp.office365.com` for business accounts)
        * **Port:** `587` (TLS)
        * **Username:** Your Outlook/Office 365 email address.

        <Note>
          See the official documentation for more details: [Manage app passwords - Microsoft Support](https://support.microsoft.com/account-billing/how-to-get-and-use-app-passwords-5896ed9b-4263-e681-128a-a6f2979a7944)
        </Note>
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="3. SendGrid (Twilio)" icon="envelope-open-text">
    <Steps>
      <Step title="Create an API Key">
        Log in to SendGrid, go to **Settings > API Keys**, and click **Create API Key**.
      </Step>

      <Step title="Assign permissions">
        Select **Restricted Access**, grant **Mail Send > Full Access**, and proceed to create.
      </Step>

      <Step title="Get the information">
        Copy the API Key string starting with `SG.`. This will be your **SMTP Password**.
      </Step>

      <Step title="Connection parameters">
        * **Host:** `smtp.sendgrid.net`
        * **Port:** `465` (SSL) or `587` (TLS)
        * **Username:** `apikey` (Write exactly "apikey", not your email).

        <Note>
          See the official documentation for more details: [Sending Email with SMTP - Twilio SendGrid Docs](https://docs.sendgrid.com/for-developers/sending-email/getting-started-smtp)
        </Note>
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="4. Amazon SES" icon="aws">
    <Steps>
      <Step title="Access SMTP Settings">
        In the AWS console, open the **Amazon SES** service, and navigate to **SMTP Settings**.
      </Step>

      <Step title="Create SMTP credentials">
        Click **Create My SMTP Credentials**. The system will create a new IAM user with permissions to send emails.
      </Step>

      <Step title="Get Username and Password">
        Download or immediately copy the provided **SMTP Username** and **SMTP Password** on the final screen.
      </Step>

      <Step title="Connection parameters">
        * **Host:** (Depends on your Region, e.g., `email-smtp.us-east-1.amazonaws.com`)
        * **Port:** `465` or `587`
        * **Username:** The newly created SMTP Username string.
        * **Password:** The newly created SMTP Password string.

        <Note>
          See the official documentation for more details: [Obtaining SMTP credentials - Amazon SES Developer Guide](https://docs.aws.amazon.com/ses/latest/dg/send-email-smtp.html)
        </Note>
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="5. Brevo (Sendinblue)" icon="paper-plane">
    <Steps>
      <Step title="Access SMTP & API">
        Log in to Brevo, click on your account name in the top right corner > **SMTP & API**.
      </Step>

      <Step title="Generate a new SMTP key">
        Switch to the **SMTP** tab, and click **Generate a new SMTP key**.
      </Step>

      <Step title="Get the password">
        Name the key and copy the newly generated key string.
      </Step>

      <Step title="Connection parameters">
        * **Host:** `smtp-relay.brevo.com`
        * **Port:** `587`
        * **Username:** Your Brevo login email.
        * **Password:** The newly created SMTP key string.

        <Note>
          See the official documentation for more details: [Set up Brevo SMTP - Brevo Help Center](https://help.brevo.com/hc/en-us/articles/209432609-Set-up-Brevo-SMTP)
        </Note>
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

## Step 2: Create an Email Channel

<Steps>
  <Step title="Add a new Email channel">
    In ChatbotX, go to **Settings → Channels →** click **Add SMTP**.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/AsF-QQXD77Aec07N/images/image-310.png?fit=max&auto=format&n=AsF-QQXD77Aec07N&q=85&s=dc222c9423ec324f9dba2e1be2365159" alt="Add a new email channel" width="2992" height="1359" data-path="images/image-310.png" />
    </Frame>
  </Step>

  <Step title="Choose a Provider">
    Find and select your Email service provider from the dropdown list (e.g., Google (Gmail), Outlook, SendGrid, Amazon SES,...).

    <Frame>
      <img src="https://mintcdn.com/chatbotx/AsF-QQXD77Aec07N/images/image-311.png?fit=max&auto=format&n=AsF-QQXD77Aec07N&q=85&s=ef6ae15fb678bd1a72d417f1d715270f" alt="Choose SMTP provider" width="1012" height="1147" data-path="images/image-311.png" />
    </Frame>
  </Step>

  <Step title="Enter SMTP connection details">
    Fill in the SMTP credentials obtained in Step 1. The fields include:

    <Frame>
      <img src="https://mintcdn.com/chatbotx/AsF-QQXD77Aec07N/images/image-312.png?fit=max&auto=format&n=AsF-QQXD77Aec07N&q=85&s=cc3846bcf8e0b9bcbf4c3f5b9263c761" alt="Enter SMTP connection details" width="1008" height="1144" data-path="images/image-312.png" />
    </Frame>

    | Field            | Description                                                                                                        |
    | :--------------- | :----------------------------------------------------------------------------------------------------------------- |
    | **Host**         | The provider's SMTP server (e.g., `smtp.gmail.com`)                                                                |
    | **Port**         | The SMTP connection port (usually `587` or `465`)                                                                  |
    | **Username**     | SMTP login name (usually the email address)                                                                        |
    | **Password**     | App Password or SMTP Key (not the main login password)                                                             |
    | **From Address** | The email address that will appear as the sender when customers receive the email (e.g., `noreply@yourdomain.com`) |
  </Step>

  <Step title="Connect">
    Click **Connect** to finish the SMTP configuration setup.
  </Step>
</Steps>

## Step 3: Request permission (Opt-In) and Collect Customer Email

Before you can send Emails to customers via ChatbotX Flow, you **must** have two elements: Storing their Email address and the Customer has agreed to receive emails (Email Opt-In).

<Steps>
  <Step title="Collect Email using Get User Data">
    Use the **Get User Data** block in the flow to ask for the customer's email address. In the Reply Format section, select the **Email** format and save the result to an **Output Custom Field** (e.g., `email` field).

    <Frame>
      <img src="https://mintcdn.com/chatbotx/AsF-QQXD77Aec07N/images/image-317.png?fit=max&auto=format&n=AsF-QQXD77Aec07N&q=85&s=6f40b0d6b110cb2f83e9a083f2155fce" alt="Get User Data block" width="3143" height="1815" data-path="images/image-317.png" />
    </Frame>
  </Step>

  <Step title="Mark Email Opt-in">
    After the customer provides their email, you need to create an Action block.

    * Click the **+** sign and select **Perform Action**.
    * Click the newly created Action block, select **Email Actions**.
    * Select **Opt In Email**. This status is mandatory for the system to allow sending emails later.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/AsF-QQXD77Aec07N/images/image-318.png?fit=max&auto=format&n=AsF-QQXD77Aec07N&q=85&s=24b8e7849c4d4f96e1d157d16aacba62" alt="Email Opt-in" width="3142" height="1814" data-path="images/image-318.png" />
    </Frame>
  </Step>
</Steps>

## Step 4: Set up automated Email sending in Flow

Once customers have agreed to receive emails, you can automatically send emails anywhere in the Flow.

<Steps>
  <Step title="Add the Send Mail node">
    In the Flow workspace, click the **+** button to open the node menu. Select **Send Mail** from the list.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/of-9F-FMwj-Zi_h4/images/image-367.png?fit=max&auto=format&n=of-9F-FMwj-Zi_h4&q=85&s=33ce020a2938b7714c59a49bf03e7970" alt="Send Mail node in the Flow node menu" width="3019" height="1810" data-path="images/image-367.png" />
    </Frame>
  </Step>

  <Step title="Choose the sending channel and topic">
    In the **Send Mail** configuration panel, choose the **SMTP Channel** that should send this email. If you have connected more than one SMTP channel, select the sender that matches this Flow.

    You can also choose a **Topic ID**. An Email Topic helps you track email performance and run actions based on how contacts interact with your emails.
  </Step>

  <Step title="Fill in the email details">
    Complete the main fields in the **Send Mail** panel:

    * **From:** The sender email address. You can use a fixed address or a variable such as `{{email}}` if your Flow needs a dynamic sender.
    * **To:** By default, the system will send to the current user's email (if provided). You can also set it to send internal notification emails to your team.
    * **Subject:** The subject of the email. You can use variables (e.g., `{{first_name}}`) to personalize the subject.
    * **Preheader:** The short preview text that appears in many inboxes under the subject line.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/of-9F-FMwj-Zi_h4/images/image-369.png?fit=max&auto=format&n=of-9F-FMwj-Zi_h4&q=85&s=fbc3ddefa1f2d5ea569a0425d5d3ade7" alt="send_mail_configuration_panel" width="3024" height="1815" data-path="images/image-369.png" />
    </Frame>
  </Step>

  <Step title="Compose the email content">
    Build the email body with the editor inside the **Send Mail** panel. You can add **Heading**, **Text**, **Image**, **Button**, **Line**, **Spacing**, and **Code** blocks.

    Use variables from the contact profile or Custom Fields to personalize the message, such as order details, customer name, or support ticket information.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/of-9F-FMwj-Zi_h4/images/image-370.png?fit=max&auto=format&n=of-9F-FMwj-Zi_h4&q=85&s=ece4879476506ecb9adcbda735c42133" alt="compose_the_email_content" width="3028" height="1818" data-path="images/image-370.png" />
    </Frame>
  </Step>

  <Step title="Test and Publish">
    Click your Flow's Publish button. Try interacting with the bot to verify whether the system has successfully sent the email to your inbox.
  </Step>
</Steps>

## Manage Email Topics in Flows

**Email Topics** help you group emails sent from Flows and track how contacts interact with them. Use topics when you want to compare email performance across campaigns, order updates, onboarding messages, or internal notifications.

You can manage Email Topics from the **Flows** menu.

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/chatbotx/images/email-topics-flows-tab.png" alt="Email Topics tab in the Flows menu" />
</Frame>

<Steps>
  <Step title="Open Flows">
    In the left sidebar, click **Flows**.
  </Step>

  <Step title="Open Email Topics">
    In the Flows page, select the **Email Topics** tab.
  </Step>

  <Step title="Add a topic">
    Click **Add** to create a new Email Topic.
  </Step>

  <Step title="Name the topic">
    Enter a clear topic name, such as `Order confirmation`, `Welcome email`, or `Monthly promotion`.
  </Step>

  <Step title="Create the topic">
    Click the create button to save the topic. The topic is then available in the **Topic ID** field inside the **Send Mail** node.
  </Step>
</Steps>

### Email Topic statistics

The Email Topics page includes a statistics table for each topic.

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/chatbotx/images/email-topics-analytics-table.png" alt="Email Topics analytics table with Sent Delivered Seen and Clicked columns" />
</Frame>

| Column        | Description                                                          |
| :------------ | :------------------------------------------------------------------- |
| **Name**      | The Email Topic name                                                 |
| **Sent**      | The number of emails sent with this topic                            |
| **Delivered** | The percentage of emails delivered successfully                      |
| **Seen**      | The percentage of emails opened or seen by contacts                  |
| **Clicked**   | The percentage of contacts who clicked a link or button in the email |

### Create a topic from Send Mail

When you configure a **Send Mail** node, you can select an existing topic in **Topic ID**. If the topic does not exist yet, click **Add New** next to the field to create it quickly without leaving the Flow editor.

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/chatbotx/images/email-topic-add-new-send-mail.png" alt="Add New shortcut next to Topic ID in the Send Mail node" />
</Frame>

## Troubleshooting

If the system cannot send the email successfully, please check some of the following common cases:

<AccordionGroup>
  <Accordion title="Error: 'Authentication Failed' or 'Invalid Login'" icon="circle-exclamation">
    * **Cause:** Incorrect SMTP Username or Password.
    * **Solution:** Do not use your main login password. Ensure you have created and used a separate **App Password** or **API Key/SMTP Key** as instructed in Step 1.
  </Accordion>

  <Accordion title="Timeout or Connection Refused Error" icon="network-wired">
    * **Cause:** Incorrect SMTP Port or blocked by a firewall.
    * **Solution:** Make sure the Port matches the correct encryption standard. For example, Port `465` must use SSL, Port `587` must use TLS. If using Google Workspace, ensure IMAP/SMTP access is not disabled by the administrator.
  </Accordion>

  <Accordion title="Flow passes the Send Mail node but the email does not arrive" icon="ban">
    * **Cause:** The customer has not been granted permission (Email Opt-in) in the system.
    * **Solution:** Check the Audience data to see if the user has an Email and the **Opted-in** status. Ensure your Flow has a step passing through the `Set Email Opt-In` Action before reaching `Send Mail`.
  </Accordion>

  <Accordion title="Sent emails land in Spam folder" icon="trash">
    * **Solution:** As recommended at the beginning, configure DNS records (`SPF`, `DKIM`) for the domain displayed on the sending email (From Email). Avoid sending emails that contain too many images without text, or using "spammy" words.
  </Accordion>
</AccordionGroup>
