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

# Email (SMTP)

> Learn how to use the Email integration with Julep

## Overview

Welcome to the Email integration guide for Julep! This integration allows you to send emails using SMTP, enabling you to build workflows that require email communication capabilities. Whether you're sending notifications or managing email campaigns, this guide will walk you through the setup and usage.

## Prerequisites

<Info type="info" title="SMTP Server Credentials Required">
  To use the Email integration, you need SMTP server credentials, including the host, port, username, and password. Ensure you have access to an SMTP server before proceeding.
</Info>

## How to Use the Integration

To get started with the Email integration, follow these steps to configure and create a task:

<Steps>
  <Step title="Configure Your SMTP Server">
    Add your SMTP server credentials to the tools section of your task. This will allow Julep to authenticate requests to your email server on your behalf.
  </Step>

  <Step title="Create Task Definition">
    Use the following YAML configuration to define your email sending task:

    ```yaml Email Example [expandable] theme={"dark"}
    name: Email Task

    tools:
    - name: email_tool
      type: integration
      integration:
        provider: email
        method: send
        setup:
          host: "smtp.example.com"
          port: 587
          user: "YOUR_USERNAME"
          password: "YOUR_PASSWORD"

    main:
    - tool: email_tool
      arguments:
        to: recipient@example.com # this is a placeholder for the actual recipient email
        from: sender@example.com # this is a placeholder for the actual sender email
        subject: Hello from Julep # this is a placeholder for the actual subject
        body: This is a test email sent using Julep's Email integration. # this is a placeholder for the actual body
    ```
  </Step>
</Steps>

### YAML Explanation

<AccordionGroup>
  <Accordion title="Basic Configuration">
    * ***name***: A descriptive name for the task, in this case, "Email Task".
    * ***tools***: This section lists the tools or integrations being used. Here, `email_tool` is defined as an integration tool.
  </Accordion>

  <Accordion title="Tool Configuration">
    * ***type***: Specifies the type of tool, which is `integration` in this context.
    * ***integration***: Details the provider and setup for the integration.
      * ***provider***: Indicates the service provider, which is `email` for Email integration.
      * ***method***: Specifies the method to be used. Default is `send` if not specified. If not specified, the method will be `send` by default.
      * ***setup***: Contains configuration details.
        * ***host***: (Required) The SMTP server host.
        * ***port***: (Required) The SMTP server port.
        * ***user***: (Required) The SMTP server username.
        * ***password***: (Required) The SMTP server password.
  </Accordion>

  <Accordion title="Workflow Configuration">
    * ***main***: Defines the main execution steps.
      * ***tool***: Refers to the tool defined earlier (`email_tool`).
      * ***arguments***: Specifies the input parameters for the tool:
        * ***to***: The email address to send the email to.
        * ***from***: The email address to send the email from.
        * ***subject***: The subject of the email.
        * ***body***: The body of the email.
  </Accordion>
</AccordionGroup>

<Note>
  * Please note that the `to` and `from` arguments can accept a single email address only.
  * Replace the `YOUR_USERNAME` and `YOUR_PASSWORD` with your actual SMTP server credentials.
  * Remember to replace the SMTP server credentials and email addresses with your actual information. Ensure your SMTP server allows sending emails from the specified addresses.
</Note>

## Conclusion

With the Email integration, you can efficiently send emails using SMTP.
This integration provides a robust solution for email communication, enhancing your workflow's capabilities and user experience.

<Tip>
  For more information, please refer to the [SMTP documentation](https://docs.python.org/3/library/smtplib.html).
</Tip>
