disable email notifications
Hello, How can I suppress sending of email notifications in Jenkins, please? Committers to a job are being automatically notified when a job fails, I want to turn it off for now and I cannot see a configuration option for it. Thanks, Patrick
RE: disable email notifications
I see that I could remove the 'Send email notification' for each job, but I am setting up a large number of existing jobs on a new server, and I want to globally disable all email notifications while I set up the environment correctly such that large numbers of jobs do not fail and spam many users with bogus error messages. From: Patrick Byrne [mailto:p.by...@samsung.com] Sent: 08 November 2012 14:44 To: 'jenkinsci-users@googlegroups.com' Subject: disable email notifications Hello, How can I suppress sending of email notifications in Jenkins, please? Committers to a job are being automatically notified when a job fails, I want to turn it off for now and I cannot see a configuration option for it. Thanks, Patrick
Re: disable email notifications
If you don't want to touch to the jobs themselves, there is another quick and dirty workaround : - install a simple mail server somewhere (James, for example) - configure it to intercept all the mails, storing them somewhere or deleting them on the fly - configure Jenkins to use that mail server. 2012/11/8 Xavier Nodet xavier.no...@gmail.com I used the script below to replace the standard mail notifier with email-ext. It should be relatively easy to update it to only do the first part (remove mail notifications). But I don't know how exactly you would enable it back when you're done setting up everything. import hudson.model.* import hudson.maven.* import hudson.tasks.* import hudson.plugins.emailext.* import hudson.plugins.emailext.plugins.trigger.* for (item in Hudson.instance.items) { //if (item.name != Debug env) { // continue //} println(\njob: $item.name) recipients = \$DEFAULT_RECIPIENTS for (publisher in item.publishersList) { // Search for default Mailer Publisher (doesn't exist for Maven projects) if(publisher instanceof Mailer) { // save recipients recipients = publisher.recipients // remove publisher item.publishersList.remove(publisher) } else // Or for Extended Email Publisher if (publisher instanceof ExtendedEmailPublisher) { // save recipients (if it already exist it overrides others values) recipients = publisher.recipientList item.publishers.remove(publisher) // remove it item.publishersList.remove(publisher) } } // If we found recipients list to send mail if (recipients != null) { println (CURRENT RECIPIENT : +recipients) // We create a new Extended Email Publisher def eep = new ExtendedEmailPublisher(); eep.recipientList = recipients eep.defaultSubject = \$DEFAULT_SUBJECT eep.defaultContent = \$DEFAULT_CONTENT // With some triggers eep.configuredTriggers.add(new FailureTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) eep.configuredTriggers.add(new FixedTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) eep.configuredTriggers.add(new StillFailingTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) eep.configuredTriggers.add(new AbortedTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) // And we add/replace it in the project item.publishersList.replace(eep); } else { println (NO RECIPIENT) } } On Thu, Nov 8, 2012 at 3:47 PM, Patrick Byrne p.by...@samsung.com wrote: I see that I could remove the 'Send email notification' for each job, but I am setting up a large number of existing jobs on a new server, and I want to globally disable all email notifications while I set up the environment correctly such that large numbers of jobs do not fail and spam many users with bogus error messages. ** ** ** ** *From:* Patrick Byrne [mailto:p.by...@samsung.com] *Sent:* 08 November 2012 14:44 *To:* 'jenkinsci-users@googlegroups.com' *Subject:* disable email notifications ** ** Hello, ** ** How can I suppress sending of email notifications in Jenkins, please? ** ** Committers to a job are being automatically notified when a job fails, I want to turn it off for now and I cannot see a configuration option for it. ** ** Thanks, Patrick ** ** ** ** -- Xavier Nodet
Re: disable email notifications
This would be a once script for: https://github.com/jenkinsci/jenkins-scripts/tree/master/scriptler Interested in adding, just send a pull request? /Domi On 08.11.2012, at 16:02, Xavier Nodet xavier.no...@gmail.com wrote: I used the script below to replace the standard mail notifier with email-ext. It should be relatively easy to update it to only do the first part (remove mail notifications). But I don't know how exactly you would enable it back when you're done setting up everything. import hudson.model.* import hudson.maven.* import hudson.tasks.* import hudson.plugins.emailext.* import hudson.plugins.emailext.plugins.trigger.* for (item in Hudson.instance.items) { //if (item.name != Debug env) { // continue //} println(\njob: $item.name) recipients = \$DEFAULT_RECIPIENTS for (publisher in item.publishersList) { // Search for default Mailer Publisher (doesn't exist for Maven projects) if(publisher instanceof Mailer) { // save recipients recipients = publisher.recipients // remove publisher item.publishersList.remove(publisher) } else // Or for Extended Email Publisher if (publisher instanceof ExtendedEmailPublisher) { // save recipients (if it already exist it overrides others values) recipients = publisher.recipientList item.publishers.remove(publisher) // remove it item.publishersList.remove(publisher) } } // If we found recipients list to send mail if (recipients != null) { println (CURRENT RECIPIENT : +recipients) // We create a new Extended Email Publisher def eep = new ExtendedEmailPublisher(); eep.recipientList = recipients eep.defaultSubject = \$DEFAULT_SUBJECT eep.defaultContent = \$DEFAULT_CONTENT // With some triggers eep.configuredTriggers.add(new FailureTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) eep.configuredTriggers.add(new FixedTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) eep.configuredTriggers.add(new StillFailingTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) eep.configuredTriggers.add(new AbortedTrigger( email : new EmailType( sendToRecipientList : true, sendToDevelopers : false, includeCulprits : false, body : ExtendedEmailPublisher.PROJECT_DEFAULT_BODY_TEXT, subject : ExtendedEmailPublisher.PROJECT_DEFAULT_SUBJECT_TEXT ))) // And we add/replace it in the project item.publishersList.replace(eep); } else { println (NO RECIPIENT) } } On Thu, Nov 8, 2012 at 3:47 PM, Patrick Byrne p.by...@samsung.com wrote: I see that I could remove the 'Send email notification' for each job, but I am setting up a large number of existing jobs on a new server, and I want to globally disable all email notifications while I set up the environment correctly such that large numbers of jobs do not fail and spam many users with bogus error messages. From: Patrick Byrne [mailto:p.by...@samsung.com] Sent: 08 November 2012 14:44 To: 'jenkinsci-users@googlegroups.com' Subject: disable email notifications Hello, How can I suppress sending of email notifications in Jenkins, please? Committers to a job are being automatically notified when a job fails, I want to turn it off for now and I cannot see a configuration option for it. Thanks, Patrick -- Xavier Nodet