Jenkins Pipeline currentBuild.changeSets and retrieving emails per repository

See more here: How to get e-mail address of current Jenkins user to use in groovy script

echo 'author email:' + change.author.getProperty(hudson.tasks.Mailer.UserProperty.class).getAddress()

But it required disable groovy sandbox :(

Possibly solution has been add this to Jenkins Pipeline Shared Libraries: https://jenkins.io/doc/book/pipeline/shared-libraries/

Like this:

$ cat GetUserEmail.groovy 
#!/usr/bin/groovy

def call(body) {
    def config = [:]
    body.resolveStrategy = Closure.DELEGATE_FIRST
    body.delegate = config
    body()

    def User = config.get('user')
    return User.getProperty(hudson.tasks.Mailer.UserProperty.class).getAddress()
}

And use like this:

def changeSet = script.currentBuild.changeSets[0];
Set authors = [];
if (changeSet != null) {
    for (change in changeSet.items) {
        authors.add(GetUserEmail{user=change.author})
    }
}

You can get the author name and then use it for an example on a mailing registry or something like that:

def author = ""
def changeSet = currentBuild.rawBuild.changeSets               
for (int i = 0; i < changeSet.size(); i++) 
{
   def entries = changeSet[i].items;
   for (int i = 0; i < changeSet.size(); i++) 
            {
                       def entries = changeSet[i].items;
                       def entry = entries[0]
                       author += "${entry.author}"
            } 
 }
 print author;