In Jenkins how to add a table to an email with build result

In Jenkins i have created freestyle


parameterized job which is used to run automatic tests using Postman. So when the build is completed an email is triggered with the build attachment logs. We are using Newman in Jenkins which returns a table with the results.

So i would like to include that table into my email body when the Jenkins completes the build. I am attaching the sample table here. Kindly help me in this please also let me know if you need any additional info.

Regards
Shantanu

You can generate an HTML file and then set that as the body of the email (make sure to set the content type to HTML as well). The ${FILE} macro would probably be the most useful in this case.

1 Like

If it’s just a text table you can still write to a file and use the FILE macro in the body

@slide_o_mix Thank you so much for the suggestions. Could you please provide us a reference how can we write a file for text table in Jenkins and then use the same File macro in email body ? As i am not very much good in scripting so asking this question please pardon me.

You can find information on writeFile in the Jenkins docs. All of the content tokens (and their documentation) for email-ext can be seen in the pipeline step generator on your Jenkins instance.