You aren't actually using any variables in your mail call since you have no
$ inside the string. Generally, when using each, I like to specify the
iterator variable name (it defaults to 'it').

Approvals.each { id ->

    mail(to: "${id}@domain.com")

}

On Wed, Jul 24, 2019, 10:20 krish <vamshi.vamsh...@gmail.com> wrote:

> Hello,
>
> Anyone tried using the split for sending out the emails for approval to
> multiple recipients.
>
> In My Jenkinsfile i have something like this
>
> *Jenkinsfile*:
>
> Approvals = $SPACE == 'stage' ? '1234, 4567' : $SPACE == 'prod' ?
> '8912,3455'
>
> Assume these numbers as UserID.
>
> *Groovy code:*
>
> config.Approvals.split(,).each {
>
> mail( to: "{config.Approvals}@domain.com"
>
> }
>
> help me to work this out.
>
> thanks
> Krish
>
> --
> 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/68b15761-0abe-4899-ab29-7612e8c27b5b%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/68b15761-0abe-4899-ab29-7612e8c27b5b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAPiUgVc1XK-uZw5uuLXURcuK%3DCC%2BTLCB5Aphj3SiOgo7ZB4GXg%40mail.gmail.com.

Reply via email to