Sending email in Jenkins with body from content in file

With the Email Extension Plugin v2.61 you can just do

<pre>
${FILE, path="file_name.txt"}
</pre>

in the Default Content session and keep the format


You should be able to combine Environment Script plugin with Email-ext plugin to achieve the desired functionality.

Check the generate environment variable from script option in the build environment section.

Then create the script to read the file content, like this:

echo RELEASE_NOTES=$(cat ReleaseNotes.txt)

In the extended email notification configurations section, fill the default content field with your recently created variable $RELEASE_NOTES

Tags:

Jenkins