Search code examples
emailjenkinsjenkins-email-ext

Jenkins email-ext not sending mails out and output "Pre-send script tried to access secured objects"


Using jenkins for CI task,but it can not sending out mails.

Here is my configutarion: system config is below:

enter image description here

and here is project mail configuration:

enter image description here

And here is outputlog:

Started by user [8mha:////4Nis2K36By9QP5h851e9fPgjtTKHdnnqmcoxBqCGg2BlAAAAmB+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgYe/dLi1CL9xLyUotRyAOMeJ3/BAAAA[0mAndrewJia
Building in workspace C:\Program Files (x86)\Jenkins\workspace\EmailTest
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
Checking for post-build
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Success
Sending email for trigger: Success
messageContentType = text/plain; charset=UTF-8
Adding recipients from project recipient list
Adding recipients from trigger recipient list
Successfully created MimeMessage
Executing pre-send script
Pre-send script tried to access secured objects: classpath entry file:/C:/ajia/email-templates/ (4a3bae0a9b9ef3e2342a359514daeccb337beaeb) not yet approved for use
ERROR: Could not send email as a part of the post-build publishers.
[8mha:////4CDZUKtxqe4Q69lSu7kc7sXTiWcyvwoa7rJoTRZBvJkKAAAAVx+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0mV3NWzufebKBsTA0NFEYMUmgZnCA1SyAABjCCFBQC2xNaiYAAAAA==[0morg.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedClasspathException: classpath entry file:/C:/ajia/email-templates/ (4a3bae0a9b9ef3e2342a359514daeccb337beaeb) not yet approved for use
    at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:577)
    at hudson.plugins.emailext.ExtendedEmailPublisher.expandClasspath(ExtendedEmailPublisher.java:671)
    at hudson.plugins.emailext.ExtendedEmailPublisher.executeScript(ExtendedEmailPublisher.java:613)
    at hudson.plugins.emailext.ExtendedEmailPublisher.executePresendScript(ExtendedEmailPublisher.java:566)
    at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:450)
    at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:435)
    at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:343)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
    at hudson.model.Build$BuildExecution.cleanUp(Build.java:196)
    at hudson.model.Run.execute(Run.java:1775)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:405)
Some error occured trying to send the email...check the Jenkins log
Finished: SUCCESS

Check service on this machine ,and permission of this user for jenkins service. No strange things found.

I've no idea what's wrong with this now. Could someone know this situation and tell me the solution?

Thanks.


Solution

  • Please, take a look at this issue: https://issues.jenkins-ci.org/browse/JENKINS-22834 Here such a functionality was implemented:

    • administrators define trusted classpath additions

    So, the solution could be:

    An administrator may now go to Manage Jenkins » In-process Script Approval where a list of scripts pending approval will be shown. Assuming nothing dangerous-looking is being requested, just click Approve to let the script be run henceforth (from https://wiki.jenkins-ci.org/display/jenkins/script+security+plugin)