Getting the following error after a Jenkins upgrade to 2.380:
Error when executing failure post condition:
java.lang.NoSuchMethodError: ‘jenkins.plugins.mailer.tasks.MimeMessageBuilder jenkins.plugins.mailer.tasks.MimeMessageBuilder.addRecipients(java.lang.String, javax.mail.Message$RecipientType)’
Email notifications are no longer working.
Any advice on how to resolve it?
Did you also upgrade your plugins after upgrading Jenkins itself? I highly recommend you use an LTS instead of a weekly as they are more stable.
Yes, dependencies were upgraded as well.
It sounds like the signature for mailer plugin has changed. You can try to follow the docs or release notes at Mailer to see what might have changed.
But I’d recommend using the pipeline syntax generator at $JENKINS_URL/pipeline-syntax/ and generate the new syntax.
Did you also restart Jenkins after upgrading plugins?
Yes. Also discovered that it works from a snippet, but not from a jenkinsfile.
What do you mean it works from a snippet? Can you share your Jenkinsfile (redacted of course)?
I created a new pipeline with the following pipeline script added under Configuration:
emailext to: “###@###.com”,
subject: “Test Email”,
That works successfully.
Anything using a Jenkinsfile fails.
mail from:“###@###.com”, to: VARIABLENAME1, replyTo: VARIABLENAME1, subject: SUBJECTVARIABLE, body: CONTENTVARIABLE
You are using two different mail methods, one emailext and the other is mail, have you tried using emailext in your Jenkinsfile? mail and emailext use different plugins.
Seems like something is wrong with the mailer plugin on your setup then. I would look in the Jenkins logs to determine if there are any exceptions from loading the plugin or similar. Also, make sure it is the latest version. You can also continue to just use the emailext step everywhere, though I would definitely look into the issue more to make sure there is not something else lurking.