# Jenkins E-Mail Notification Fails

**URL:** <https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191>\
**Category:** Ask a question\
**Created:** [January 3, 2023, 9:01pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191 "2023-01-03T21:01:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenkinsuser](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jenkinsuser](https://community.jenkins.io/u/jenkinsuser)\
**Post date:** [January 3, 2023, 9:01pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/1 "2023-01-03T21:01:34Z")

</div>

Getting the following error after a Jenkins upgrade to 2.380:

[Pipeline] mail  
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?

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [January 3, 2023, 9:21pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/2 "2023-01-03T21:21:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jenkinsuser](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jenkinsuser](https://community.jenkins.io/u/jenkinsuser)\
**Post date:** [January 3, 2023, 9:36pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/3 "2023-01-03T21:36:20Z")

</div>

Yes, dependencies were upgraded as well.

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [January 3, 2023, 11:14pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/4 "2023-01-03T23:14:37Z")

</div>

It sounds like the signature for mailer plugin has changed. You can try to follow the docs or release notes at [Mailer](https://plugins.jenkins.io/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.

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [January 5, 2023, 2:58pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/5 "2023-01-05T14:58:26Z")

</div>

Did you also restart Jenkins after upgrading plugins?

---

<div class="post-metadata">

**Author:** ![jenkinsuser](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jenkinsuser](https://community.jenkins.io/u/jenkinsuser)\
**Post date:** [January 5, 2023, 3:24pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/6 "2023-01-05T15:24:40Z")

</div>

Yes. Also discovered that it works from a snippet, but not from a jenkinsfile.

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [January 5, 2023, 3:45pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/7 "2023-01-05T15:45:09Z")

</div>

What do you mean it works from a snippet? Can you share your Jenkinsfile (redacted of course)?

---

<div class="post-metadata">

**Author:** ![jenkinsuser](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jenkinsuser](https://community.jenkins.io/u/jenkinsuser)\
**Post date:** [January 5, 2023, 4:05pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/8 "2023-01-05T16:05:06Z")

</div>

I created a new pipeline with the following pipeline script added under Configuration:

post{  
always{  
emailext to: “###@###.com”,  
subject: “Test Email”,  
body: “Test”,  
attachLog: true  
}

That works successfully.

Anything using a Jenkinsfile fails.  
mail from:“###@###.com”, to: VARIABLENAME1, replyTo: VARIABLENAME1, subject: SUBJECTVARIABLE, body: CONTENTVARIABLE

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [January 5, 2023, 5:11pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/9 "2023-01-05T17:11:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jenkinsuser](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jenkinsuser](https://community.jenkins.io/u/jenkinsuser)\
**Post date:** [January 5, 2023, 6:51pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/10 "2023-01-05T18:51:25Z")

</div>

That did it. Thanks!

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [January 5, 2023, 8:55pm UTC](https://community.jenkins.io/t/jenkins-e-mail-notification-fails/5191/11 "2023-01-05T20:55:17Z")

</div>

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.
