Export artifacts by email
You can use the Email plugin to export reports, data, and other artifacts by email.
Use the Email plugin
- 
Add an SMTP configuration in Harness. Username and Password are not required. 
- 
Make sure your pipeline produces the artifact that you wan to include in the email, such as a .txt,.html, or.csvfile. For example:- 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
- 
Use the Email plugin in a Plugin step, for example: - 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.
For information about the Plugin step settings, go to the Plugin step settings documentation.
Send with username and password authentication
You don't need to provide the SMPT 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.
Send data in the body
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.
              - 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
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.
              - 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