Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41210

Cannot define custom email body

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Blocker Blocker
    • email-ext-plugin
    • None
    • Jenkins ver. 1.642.2, Email Extension Plugin v2.53

      I have read the documentation but cannot understand how to customize the email body. I am an experienced Perl software developer, but I have no experience of jelly or groovy. I understand the principle but the instructions are lacking in detail.

      What I've tried:
      In the "Pre-send Script" field I have put: ${SCRIPT,template="hello.groovy"}
      In the file /var/jenkins_home/email-templates/hello.groovy I have put:
      <%
      println "Hello world!"
      %>

      When I test this in the "Email Template Testing" page, I get the result: Hello world!

      But when I try it in a real job, I get the error below in the console:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Script1.groovy: 1: unexpected token: world @ line 1, column 7.
      Hello world!
      ^
      1 error
      (stack trace snipped)

      Could a minimal "hello world" script be provided which demonstrates how to define an email body?

            davidvanlaatum David van Laatum
            randomje Random Je
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: