# KRE - Setup Email as part of CI/CD Azure

**URL:** <https://forum.katalon.com/t/kre-setup-email-as-part-of-ci-cd-azure/172033>\
**Category:** Feature Request\
**Tags:** email, integrations, katalon-studio\
**Created:** [April 24, 2025, 3:10am UTC](https://forum.katalon.com/t/kre-setup-email-as-part-of-ci-cd-azure/172033 "2025-04-24T03:10:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![senthil.dharmarajan](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/senthil.dharmarajan/32/23870_2.png) [@senthil.dharmarajan](https://forum.katalon.com/u/senthil.dharmarajan)\
**Post date:** [April 24, 2025, 3:10am UTC](https://forum.katalon.com/t/kre-setup-email-as-part-of-ci-cd-azure/172033/1 "2025-04-24T03:10:13Z")

</div>

Katalon Studio support send email feature as part of the Test Suite. But when running the tests in Azure Cloud, there is no way to configure Email.

Running tests on Azure Cloud is using online license and fresh installation of Katalon Studio each time.

Is there a way to setup email during a fresh installation using any command line tool? There is a -sendEmail functionality for command line but there is no way to configure it unless user can access Katalon Studio.

When running on cloud, user cannot access Katalon studio UI.

---

<div class="post-metadata">

**Author:** ![dineshh](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dineshh/32/24488_2.png) [@dineshh](https://forum.katalon.com/u/dineshh)\
**Post date:** [April 24, 2025, 5:54am UTC](https://forum.katalon.com/t/kre-setup-email-as-part-of-ci-cd-azure/172033/2 "2025-04-24T05:54:49Z")

</div>

To configure email notifications in **Katalon Studio** when running tests on **Azure Cloud** (without UI access), use a **command-line-driven approach** with preconfigured settings. Here’s how:

## **1. Use `katalon-config.properties` for Email Settings**

Create a `katalon-config.properties` file in your project with placeholders for Azure variables:

```auto
# Email Settings
notification.email.enabled=true
notification.email.smtp.host=${SMTP_HOST}
notification.email.smtp.port=${SMTP_PORT}
notification.email.smtp.username=${SMTP_USER}
notification.email.smtp.password=${SMTP_PASSWORD}
notification.email.sender=${SENDER_EMAIL}
notification.email.recipients=${RECIPIENTS}
notification.email.subject=Azure Test Report
notification.email.body=Test execution completed. Attached is the report.
notification.email.attachReport=true

```

## **2. Inject Azure Pipeline Variables**

In your `azure-pipelines.yml`, define variables (including secrets):

```auto
variables:
  SMTP_HOST: 'smtp.office365.com'
  SMTP_PORT: '587'
  SMTP_USER: 'your-email@company.com'
  SMTP_PASSWORD: $(SMTP_PASSWORD_SECRET) # Azure secret variable
  SENDER_EMAIL: 'your-email@company.com'
  RECIPIENTS: 'recipient1@company.com,recipient2@company.com'

```

## **3. Replace Placeholders in CI/CD Script**

Use `sed` (Linux) or PowerShell (Windows) to replace placeholders in `katalon-config.properties`:

```auto
sed -i "s/\${SMTP_HOST}/$SMTP_HOST/g" katalon-config.properties
sed -i "s/\${SMTP_PORT}/$SMTP_PORT/g" katalon-config.properties
# Repeat for all variables

```

## **4. Execute Katalon with Overridden Config**

Run Katalon in Azure with the modified config:

```auto
./katalon \
  -noSplash \
  -runMode=console \
  -projectPath="$(pwd)/your-project.prj" \
  -retry=0 \
  -testSuitePath="Test Suites/your-suite" \
  -sendEmail \
  -config="$(pwd)/katalon-config.properties" \
  -executionProfile=azure-cloud \
  -browserType="Remote" \
  -statusDelay=15

```

## **5. Alternative: Direct Command-Line Arguments**

If you prefer not to use a config file:

```auto
./katalon \
  ...other args... \
  -sendEmail \
  -Dnotification.email.enabled=true \
  -Dnotification.email.smtp.host=$SMTP_HOST \
  -Dnotification.email.smtp.port=$SMTP_PORT \
  -Dnotification.email.smtp.username=$SMTP_USER \
  -Dnotification.email.smtp.password=$SMTP_PASSWORD \
  -Dnotification.email.recipients=$RECIPIENTS

```

## **6. Handle Security for SMTP (Office 365 Example)**

For Office 365 SMTP, ensure these settings are included:

```auto
-Dnotification.email.smtp.starttls.enable=true \
-Dnotification.email.smtp.auth=true

```

## **7. Attach Reports Programmatically**

If Katalon’s native email attachment fails, manually attach the report:

```auto
REPORT_PATH="$(pwd)/Reports/*.html"
echo "Attaching report: $REPORT_PATH"
# Use Azure's built-in email task with attachments
- task: CmdLine@2
  inputs:
    script: |
      sendmail -t <<EOF
      To: $RECIPIENTS
      From: $SENDER_EMAIL
      Subject: Azure Test Report
      MIME-Version: 1.0
      Content-Type: multipart/mixed; boundary="KATALON"
      --KATALON
      Content-Type: text/html
      Test execution completed.
      --KATALON
      Content-Type: text/html; name="report.html"
      Content-Disposition: attachment; filename="report.html"
      $(cat $REPORT_PATH)
      --KATALON--
      EOF

```

## **8. Full Azure Pipeline YAML Example**

```auto
jobs:
- job: Run_Katalon_Tests
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - task: Bash@3
    inputs:
      targetType: 'inline'
      script: |
        # Install Katalon
        wget https://download.katalon.com/10.1.1/katalon-10.1.1-linux.zip
        unzip katalon-10.1.1-linux.zip -d katalon
        
        # Set permissions
        chmod +x katalon/katalon
        
        # Inject SMTP settings
        sed -i "s/\${SMTP_HOST}/$SMTP_HOST/g" katalon-config.properties
        sed -i "s/\${SMTP_PORT}/$SMTP_PORT/g" katalon-config.properties
        sed -i "s/\${SMTP_USER}/$SMTP_USER/g" katalon-config.properties
        sed -i "s/\${SMTP_PASSWORD}/$SMTP_PASSWORD/g" katalon-config.properties
        sed -i "s/\${SENDER_EMAIL}/$SENDER_EMAIL/g" katalon-config.properties
        sed -i "s/\${RECIPIENTS}/$RECIPIENTS/g" katalon-config.properties
        
        # Run tests with email
        ./katalon/katalon -sendEmail -config=katalon-config.properties ...

```

This approach ensures email notifications work seamlessly in Azure Cloud without requiring UI interaction.

---

<div class="post-metadata">

**Author:** ![senthil.dharmarajan](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/senthil.dharmarajan/32/23870_2.png) [@senthil.dharmarajan](https://forum.katalon.com/u/senthil.dharmarajan)\
**Post date:** [April 25, 2025, 3:07am UTC](https://forum.katalon.com/t/kre-setup-email-as-part-of-ci-cd-azure/172033/3 "2025-04-25T03:07:43Z")

</div>

Thank you, Dinesh. This is what I was looking for.

---

<div class="post-metadata">

**Author:** ![dineshh](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dineshh/32/24488_2.png) [@dineshh](https://forum.katalon.com/u/dineshh)\
**Post date:** [April 26, 2025, 5:29am UTC](https://forum.katalon.com/t/kre-setup-email-as-part-of-ci-cd-azure/172033/4 "2025-04-26T05:29:42Z")

</div>

Perfect @senthil.dharmarajan !!
