Jenkins - sending email after build with the build version as a subject
I found a way to set environmental variables globally from a file!
I'm using envInject for loading variables from a file.

For example, lets say I have a file that is called "versionNumber.txt" and that it's created during the build process. Maybe I update it in every build, or any other way. then I create a prosFile that can be identified by the envInject, by running a batch script:

set /p VERSION_NUM=&lt;versionNumber.txt


Let's assume my version number was 1.5.5.10. so now my VERSION_NUM equals that string.
now VERSION_NUM has the value that I want. But it's local, it won't help me. so I rewrite it to a file in the following format (also, using a batch script):

echo VERSION_NUM=%VERSION_NUM% &gt; C:\Temp\prosFile


now I have a file that contains the following content:

VERSION_NUM=1.5.5.10


And now I just need to load the file using the envInject plugin:



And now I have an environmental variable named VERSION_NUM that can be used anywhere in Jenkins. But I wanted to make it the subject of my email, so I'll simply do (in windows, in linux it might be different):



That's it!