Send Jenkins console output as HTML email
email-ext plugin works pretty well for me. Give it a try.
Email Ext plugin works just fine with HTML. It's up to your email client to parse HTML (but then again, most these days do).
The question is: how does your build output this HTML above? Does it output it to file? Does it display it in Console Output?
If the text is in console output, use:
<pre>${BUILD_LOG_EXCERPT, start="Regex-for-start", end="Regex-for-end"}</pre>
The <pre>
tags are to preserve spacing/formatting.
The start
and end
regular expressions are to identify the "starting line" from which to start displaying log, and the "ending line" at which to stop displaying log.
Note that the start
and end
lines themselves are excluded. So, in your build, put a header and footer lines just before and just after your html output, and use them here.
For reference, in the email-ext configuration, click the Content Reference question mark icon ?
Go to "Manage-jenkins"->"configure system" Than on the "Extended E-mail Notification" settings, put the below line in "default content" text-area
<pre>${BUILD_LOG, maxLines=9999, escapeHtml=false}</pre>
So this is how I solved it with the help of @Slav.
Jenkins job was running this script:
<?php
echo "start-here\n";
echo "<html><body><table border=1>
<tr><td>yello1111</td><td>11111bbbbbbb</td></tr>
<tr><td>yelloooo</td><td>bbbbbbb</td></tr>
</table></body></html>";
echo "end-here\n";
The job was configured with email-ext and in the Add post-build action->Editable Email Notification -> Default Content I put the following:
${BUILD_LOG_EXCERPT, start="\\b(start-here)\\b", end="\\b(end-here)\\b"}
This send the email as html content and not the text of html.