Email ext to send html body in Pipeline

2,749 views
Skip to first unread message

Sam K

unread,
Oct 10, 2016, 1:21:28 AM10/10/16
to Jenkins Users
This works for most part.  Except, I have a html formatted file which I would like to send as the body.  Is it possible?  Thanks

emailext attachmentsPattern: '*.log, *.html', body: 'BUILD_URL = ' + env.BUILD_URL, subject: 'END Coded Pipeline Build SOURCE - ' + CODE_BRANCH + ' TESTS - ' + TEST_BRANCH, to: MAILING_LIST

Mark Bidewell

unread,
Oct 11, 2016, 10:24:01 AM10/11/16
to Jenkins Users
Support for templates was added in 2.50 if that helps.

Sam K

unread,
Oct 11, 2016, 2:26:58 PM10/11/16
to Jenkins Users
Thanks for bringing this to my attention Mark.  I was not aware of that.  The jelly scripts are great which send predefined content.  In my case, I am generating content which I want to send in the body.  

I am trying to work with mutt email client but having other roadblocks.  :(

Sam K

unread,
Oct 12, 2016, 4:57:04 PM10/12/16
to Jenkins Users
Is there a plan to allow the ${FILE,path="${DIR}/test.html"} option that is already available in the plugin?  That is EXACTLY what most would want I presume.  :) 

Slide

unread,
Oct 13, 2016, 10:10:29 AM10/13/16
to Jenkins Users

I believe that was added in 2.50 that was released recently.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ba748cfd-f69b-485c-b797-51572934e22b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

jer...@bodycad.com

unread,
Oct 14, 2016, 12:57:15 PM10/14/16
to Jenkins Users
Hi,

I found the Jelly script way of doing it, see my post into this forum. does the  '${FILE,path="/tmp/test.html"}' does the Token replacement? can you use any form of script into it (for loop? jelly? groovy?).

Thanks

Sam K

unread,
Oct 14, 2016, 7:07:02 PM10/14/16
to Jenkins Users
Hmm, not sure what you're asking...but the FILE,path along with the mimeType: 'text/html' does send any html file in the body of the email. 

jer...@bodycad.com

unread,
Oct 17, 2016, 9:34:45 AM10/17/16
to Jenkins Users
Hi, Sam I was just wondering if the FILE type could use the token replacement like the follwoing:

<a href="${rooturl}${build.url}">Jenkins project</a>

into the email body. I tested it on my side just out of curiosity and it does not make the token replacement as of writting this.

For those who need it:
'${JELLY_SCRIPT,template="/tmp/test.jelly"}'  for Jelly template
or
'${SCRIPT,template="/tmp/test.template"}'  for groovy template

Slide

unread,
Oct 17, 2016, 11:48:31 AM10/17/16
to Jenkins Users
rooturl and build are variables that are put into the binding for the Jelly and Groovy templating. They can't be used directly.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages