> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-integration/use-harness-ci/use-harness-ci/build-and-upload-artifacts/drone-email-plugin.md).

# Export artifacts by email

You can use the [Email plugin](https://github.com/harness-community/drone-email) to export reports, data, and other artifacts by email.

### Use the Email plugin <a href="#use-the-email-plugin" id="use-the-email-plugin"></a>

1. [Add an SMTP configuration in Harness](/harness-ai/use-harness-platform/notifications-alerts-and-banners/notifications/add-smtp-configuration.md). **Username** and **Password** are not required.
2. Make sure your pipeline produces the artifact that you wan to include in the email, such as a `.txt`, `.html`, or `.csv` file. For example:

   ```yaml
                 - step:
                     type: Run
                     name: Run_1
                     identifier: Run_1
                     spec:
                       connectorRef: YOUR_DOCKER_CONNECTOR_ID
                       image: alpine
                       shell: Sh
                       command: |-
                         touch test.html

                         echo "My Test HTML" > test.html

                         cat test.html
   ```
3. Use the Email plugin in a [Plugin step](/continuous-integration/use-harness-ci/use-harness-ci/use-drone-plugins/plugin-step-settings-reference.md), for example:

   ```yaml
                 - step:
                     type: Plugin
                     name: Plugin_1
                     identifier: Plugin_1
                     spec:
                       connectorRef: YOUR_DOCKER_CONNECTOR_ID
                       image: plugins/email ## This is the email plugin image.
                       settings:
                         from.name: Harness CI ## The sender name
                         from.address: sender@mysite.com ## The email address to send the notification from. Can be the same as the From Address in your Harness SMTP configuration.
                         recipients: test@mysite.com ## List of recipients to send the email to (besides the commit author).
                         host: smtp.somesmtpserver.com ## SMTP server address from your Harness SMTP configuration.
                         port: "25" ## SMTP server port from your Harness SMTP configuration.
                         skip_verify: "true" ## Set to 'true' to skip cert verification.
                         subject: somesubject ## Subject line.
                         body: file:///harness/test.html ## The email body. This can be an inline template or a URL. `file:///` is allowed.
                         recipients_only: true
   ```

For information about Email plugin settings, go to the [Email plugin documentation](https://github.com/harness-community/drone-email).

For information about the Plugin step settings, go to the [Plugin step settings documentation](/continuous-integration/use-harness-ci/use-harness-ci/use-drone-plugins/plugin-step-settings-reference.md).

### Send with username and password authentication <a href="#send-with-username-and-password-authentication" id="send-with-username-and-password-authentication"></a>

You don't need to provide the SMTP `username` and `password`, but you can include these parameters if you want or need to. For information about Email plugin settings, including the `username` and `password`, go to the [Email plugin documentation](https://github.com/harness-community/drone-email).

### Send data in the body <a href="#send-data-in-the-body" id="send-data-in-the-body"></a>

You can send the data either in the body of the email or as an attachment.

Here's an example of a Plugin step where the data is in the email body.

```yaml
              - step:
                  type: Plugin
                  name: Plugin_1
                  identifier: Plugin_1
                  spec:
                    connectorRef: YOUR_IMAGE_REGISTRY_CONNECTOR
                    image: plugins/email
                    settings:
                      from.name: Harness CI
                      from.address: sender@mysite.com
                      recipients: test@mysite.com
                      host: smtp.somesmtpserver.com
                      port: "25"
                      skip_verify: "true"
                      subject: somesubject
                      body: file:///harness/test.html
                      recipients_only: true
```

### Send data as an attachment <a href="#send-data-as-an-attachment" id="send-data-as-an-attachment"></a>

You can send the data either in the body of the email or as an attachment.

Here's an example of a Plugin step where the data is sent as an attachment.

```yaml
              - step:
                  type: Plugin
                  name: Plugin_1
                  identifier: Plugin_1
                  spec:
                    connectorRef: YOUR_IMAGE_REGISTRY_CONNECTOR
                    image: plugins/email
                    settings:
                      from.name: Harness CI
                      from.address: sender@mysite.com
                      recipients: test@mysite.com
                      host: smtp.somesmtpserver.com
                      port: "25"
                      skip_verify: "true"
                      subject: somesubject
                      body: somebody
                      attachment: /harness/test.html
                      recipients_only: true
```
