If you are using freestyle projects, you can set a file as the mail's content in your presend script:
def reportPath = build.getWorkspace().child("mail.txt");
msg.setContent(reportPath.readToString(), "text/plain");
In declarative pipelines:
emailext (
body: readFile('mail.txt')
)
You can add anything to that .txt file; for example, I include the changed file names to the mail (using SVN), and the error log:
echo Build successful, changeset: > mail.txt && svn diff -r COMMMITTED:PREV >> mail.txt
echo Build failed, changeset: > mail.txt && svn diff -r COMMMITTED:PREV >> mail.txt && echo Errors: >> mail.txt && cat error.log >> mail.txt