I wanted to show the user who triggered a Jenkins job in the post job email. This is possible by using the plugin Build User Vars Plugin and the env variable
This gets the username who clicked "Build Now" in a Jenkins pipeline job.
@NonCPS def getBuildUser() { return currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId() }