How can I set the Sender's address in Jenkins?

后端 未结 6 1054
心在旅途
心在旅途 2021-01-30 19:16

I\'m sending mail from Jenkins to an anonymous SMTP relay internally. That relay then securely sends mail to exchange online via TLS on port 587. The transport works perfectly,

6条回答
  •  情书的邮戳
    2021-01-30 19:54

    If you need to do this without using the jenkins UI (for instance in automating a jenkins setup) - you can do so with a groovy script.

    import jenkins.model.*
    
    def jenkinsLocationConfiguration = JenkinsLocationConfiguration.get()
    
    jenkinsLocationConfiguration.setAdminAddress("[your admin name] <[your admin email address]>")
    // example format -> .setAdminAddress("Jane Doe ")    
    
    jenkinsLocationConfiguration.save()
    

    Do note: I did not write this script (although I have tested it and it works), all credit to Peter Halliday and his website with other helpful groovy scripts here.

提交回复
热议问题