Hey David,

This should be pretty straightforward, try this:
    post {
        success {
            emailext (
                to: a...@me.com; a...@him.com,
                subject: "SUCCESS",
                body: "SUCCESS!"
            )
        }
        failure {
emailext (
                to: a...@me.com; a...@him.com,
                subject: "FAILURE",
                body: "FAILURE!"
            )
        }
    }

On Tue, May 16, 2017 at 11:25 AM David Aldrich <david.aldr...@emea.nec.com>
wrote:

> Hi
>
>
>
> I am experimenting with declarative scripts and have this simple script:
>
>
>
> pipeline {
>
>     agent { label "mypc" }
>
>     stages {
>
>         stage('build') {
>
>             steps {
>
>                 sh 'python --version'
>
>             }
>
>         }
>
>     }
>
>     post {
>
>         success {
>
>             script: emailext (subject: "STARTED: Job '${env.JOB_NAME}
> [${env.BUILD_NUMBER}]'",
>
>                               body: """<p>STARTED: Job '${env.JOB_NAME}
> [${env.BUILD_NUMBER}]':</p>
>
>                               <p>Check console output at &QUOT;<a
> href='${env.BUILD_URL}'>${env.JOB_NAME}
> [${env.BUILD_NUMBER}]</a>&QUOT;</p>""",
>
>                               recipientProviders: [$class:
> 'DevelopersRecipientProvider']])
>
>         }
>
>     }
>
> }
>
>
>
> I can’t specify the list of default recipients in the global settings for
> the email-ext plugin, as the required recipients change from project to
> project.  I need to specify the list in the script.  I’ve received a
> suggestion to:
>
>
>
> “use this pipeline step
> https://jenkins.io/doc/pipeline/steps/email-ext/#emailextrecipients-extended-email-recipients
>  to
> get the recipients and then use the "to" parameter to the emailext step and
> add your own addresses to the return of that step”
>
>
>
> I don’t know how to do this. Please could someone show me how to modify my
> script to do it?
>
>
>
> Best regards
>
>
>
> David
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/21c2aac48caa41998f52a2e233d4ed76%40EUX13SRV1.EU.NEC.COM
> <https://groups.google.com/d/msgid/jenkinsci-users/21c2aac48caa41998f52a2e233d4ed76%40EUX13SRV1.EU.NEC.COM?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAObRFCX0ZaN4MPqiNy9tB8z0nr_g1zFrZ1Ssa24Bhb997G7p4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to