# SMTP

SMTP (Simple Mail Transfer Protocol) in ZBrain Flow allows you to send emails through your own custom mail server or third-party SMTP provider. By integrating SMTP, you gain control over email deliverability, branding, and security, enabling you to automate notifications, send transactional messages, or distribute marketing campaigns directly from your chosen email service.

#### **How to Integrate SMTP with ZBrain Flow?** <a href="#how-to-integrate-smtp-with-zbrain-flow" id="how-to-integrate-smtp-with-zbrain-flow"></a>

1. **Click the “+” Button in the Flow**\
   Open your ZBrain Flow and select the plus sign (**+**) to add a new step.
2. **Search for “SMTP”**\
   Type **“SMTP”** in the search bar to view the available tasks.
3. **Choose the Desired Task**\
   Select **Send Email** to configure and send messages using your custom SMTP server settings.

* Tasks you can perform on SMTP.
  * **Send Email**\
    Compose and deliver emails through your own SMTP server or a third-party email service provider.

#### **Send Email** <a href="#send-email" id="send-email"></a>

Compose and deliver emails through your own SMTP server or a third-party email service provider.

#### **How to Configure the “Send Email” Action with SMTP in ZBrain Flow?** <a href="#how-to-configure-the-send-email-action-with-smtp-in-zbrain-flow" id="how-to-configure-the-send-email-action-with-smtp-in-zbrain-flow"></a>

**Step 1: Add the “Send Email” Step**

1. **Insert a New Step**
   * In your flow, click the **+** button to add a new step.
2. **Search for “SMTP”**
   * Type **“SMTP”** in the search bar and select **Send Email** from the available actions.

**Step 2: Create or Select an SMTP Connection**

* Select an already-created connection or create a new one from the **Connection** field. To create a new connection, follow the below-mentioned steps:
  * Provide connection details
    1. **Connection Name**
       * Give your SMTP connection a descriptive name (e.g., “My SMTP Server”).
       * This helps you identify and manage multiple connections if you use more than one SMTP service.
    2. **Host**
       * Enter the **SMTP server address** (e.g., `smtp.yourdomain.com`).
       * This is the server responsible for sending your emails.
    3. **Email**
       * Provide the **email address** you’ll use to authenticate with the SMTP server.
       * This address often appears as the “From” or “Sender” address in your outgoing emails.
    4. **Password**
       * Enter the **password** associated with the provided email account.
       * Ensure you store your password securely and have permission to send emails from this address.
    5. **Port**
       * Select the **SMTP port** your email provider requires (e.g., **587**, **465**, or **25**).
       * Refer to your SMTP provider’s documentation for the correct port number.
    6. **Require TLS? (Toggle)**
       * Enable this if your SMTP server requires **TLS/SSL** encryption.
       * TLS/SSL ensures secure transmission of email data, protecting sensitive information like passwords.
       * **Click “Save”**
         * Once you’ve filled out all required fields, click **Save** to confirm your SMTP settings.

**Step 3: Configure the “Send Email” Action**

1. **From Email**
   * The **email address** from which the email will be sent.
   * This should match the account configured in your SMTP connection.
2. **Sender Name** (Optional)
   * Provide a **friendly name** (e.g., “Support Team”) that appears alongside the sender’s email address.
3. **To** (Add Item)
   * Enter the **recipient’s email address**.
   * You can add multiple recipients by clicking **Add Item** again.
4. **CC / BCC** (Optional)
   * Use these fields to **carbon copy** or **blind carbon copy** additional recipients as needed.
5. **Reply To** (Optional)
   * Specify an address where replies should be directed, if different from the “From” address.
6. **Subject**
   * Enter a **descriptive subject line** for your email.
7. **Body Type**
   * Select **plain text** or **HTML** based on how you want the email’s content formatted.
8. **Body**
   * Write the **content** of your email here.
   * If using HTML, you can include markup for formatting and images.
9. **Custom Headers** (Optional)
   * Add any additional **headers** (e.g., `X-Priority: 1`) if required by your mail server or workflow.
10. **Attachment** (Optional)
    * Click the **Add Item** button to attach one or more files to the email.
    * You can select files from previous steps in your flow or upload them directly.
    * Make sure your SMTP provider supports the file size and type.


---

# 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.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/smtp.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.
