I need to add an image in email as email body not as attachment, from Jenkins via pipeline. I am using emailext plugin in Jenkins pipeline, below is the code I am using.
emailext (
subject: "test email",
body: """
<html>
<body>
<p>please find attached score: Job '${env.JOB_NAME}':</p>
<p> The last commit was by ${last_commit_user} </p>
<p>Please check jenkins console at "</p>
<p> For detailed report on this analysis, visit "</p>
</body>
</html>
""",
to: email_recipients,
attachmentsPattern: '${BUILD_NUMBER}.jpg'
)
I do not want to use "attachmentsPattern" , that comes as an attachment, I tried using,
body: """
<html>
<img src="image_name.jpg" >
</html>
"""
That comes only as blue box in my email , I am giving proper image path relative to my Jenkins workspace, I tried to search relevant solutions but in vain.