I am running from my pipeline a snippet to send html mail from HTML file. it looks like that:
emailext(to: "${BUILD_USER_EMAIL}", mimeType: 'text/html', subject: "dummy subject", body: readFile 'pipeline/mail/summary.html');
My question: How can I embed image file (as part of the mail) using CID or something similar? it only works if I am adding the IMG tag to my HTML file linking to a url that actually available from my org. I just need the image to be embedded as part of the mail. Thanks, Nir
You can embed an image via base64. Convert the image here or however you want then enter it into your pipeline script like this:
(example is from Jenkinsfile)
emailext attachmentsPattern: '%JENKINS_HOME%/changelog.xml', body: '<img src="data:image/png;base64,iVBORw0K...shortened...rkJggg==">', mimeType: 'text/html', subject: 'Look at this subject!', to: '[email protected]'
Very important, the latest version can only support up to 65535 characters in the body and the encoding can easily surpass that limit.