Unable to send Email Notification after sonar quality gate success while using Jenkin Script

Pipeline Script used
stage(‘Sonarqube - Quality Gate’){
steps{
script{
timeout(time: 1, unit: ‘HOURS’) {
def qg = waitForQualityGate()
if (qg.status != ‘OK’) {
error “Pipeline aborted due to quality gate failure: ${qg.status}”
def script_regex = ‘${BUILD_LOG_REGEX, regex=“^The module”, maxMatches=5, showTruncatedLines=false, escapeHtml=true}’
if (script_regex){
emailext to: “abc@.com”,
subject: “some subj”,
body: script_regex
Sonar gate is successful but no email received

Hi,

Welcome to the community!

Sending emails directly from your pipeline is out of the scope of this community.

BTW, you can subscribe to be notified by SonarQube when a project’s Quality Gate status changes (i.e. it won’t send you an email for every success; only when the previous result was failure).

 
HTH,
Ann

Thanks for the reply