How to send extent reports in email with screenshots

How to send extent reports in email with screenshots
How to send extent reports in email with screenshots,While working with Extent Reports,we are able to take the screenshots ,able to attach into Extent html Reports,but while sending those reports in email screenshots not displays.

I’ve figured how to display screenshots in Extent Reports,if html file location is changed from one folder to another folder with the simple trick as per Extent Reports site directions,already this question is asked in GitHub in Anshu Arora blog,they have given some directions to solve this problem but no one has solved this.

Send Extent Reports in Email

Code Sample

public class SampleTest{
String concatenate = ".";
String screenshot_Name;
// FAIL Screenshots
screenshot_Name = concatenate + getScreenshot(driver, "TestName");
Reporting.testFailLogs("Taking Screenshot for FAIL Step-Reason");
Reporting.screenCapture("TestName", screenshot_Name);
System.out.println("Script Exception Error Message: " + e);

public static String getScreenshot(WebDriver driver, String screenshotName) throws Exception {
File sourceFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
String imgPath = "./" +reports/Screenshots/" + screenshot + "_"+ System.currentTimeMillis() + ".png";
File path = new File("./Reports/" + imgPath);
FileUtils.copyFile(sourceFile, path);
return imgPath;
public static Object screenCapture(String logdetails, String imagepath) throws IOException {
// report with snapshot
test.log(Status.INFO, logdetails, MediaEntityBuilder.createScreenCaptureFromPath(imagepath).build());
return test;


ALSO READ  Page Object Model in Selenium WebDriver Step by Step Guide

Please provide your valuable comments on this How to send Extent reports in email with screenshots and give me feedback on this code.Thank you for reading…

How to send the screenshots alongwith HTML report via email

how to email extent report
emailable extent report
how to send extent report in email through jenkins
how to send extent report through email
how to email extent report in jenkins
how to attach screenshot in extent report in selenium
add screenshot in extent report c#
emailable extent reports with jenkins

Rajesh K

One thought on “How to send extent reports in email with screenshots

  1. Hi Rajesh,

    I am new to automation, also new to c# and i am trying to use extent reports in my current project. So before using the above code for sending the reports through email what is that I need to insall from nugget package, what are the other basic methods or classes that I need to create. Please let me know


Comments are closed.