Search code examples
jenkinsjenkins-pluginsemail-ext

Display text page inside mail body with Email-ext plugin in Jenkins


I'm attaching a text file to the content of the email that is sent from jenkins, the thing is that the content of this file doesn't appear as it appear in any notepad, i've tried sending the email as plain text and as html but it still displaying the content in a diferent way. For example if this is one of the lines in the file:

+------------------------------------------------------------------------------+
                      MSP-B Automated Testing Report
+------------------------------------------------------------------------------+
| scale-ive-0001-vertical-vpm2-160_prog_1_zone-check-acquire-time.py........OK |

This is how it looks like in the email:

+------------------------------------------------------------------------------+
                      MSP-B Automated Testing Report
+------------------------------------------------------------------------------+
| scale-ive-0001-vertical-vpm2-160_prog_1_zone-check-acquire-time.py....
| ....OK | 

Solution

  • For one of my Jenkins jobs I use the following together with HTML as overall email format,

    $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
    
    Check console output at $BUILD_URL to view the results.
    
    <pre>
    ${FILE,path="Results.txt"}
    </pre>
    

    This way the email is formatted as HTML and the "pre" tag instructs the mail client to not change the format of the included file.