EmailReporter

ExtentEmailReporter creates an elegant, email-friendly report and support both BDD and non-BDD test styles. The email format is tested to work well with most major email clients and browsers.

ExtentEmailReporter email = new ExtentEmailReporter("user/build/name/");
ExtentReporter extent = new ExtentReports();
extent.attachReporter(email);

Configuration

You can apply custom configuration to each reporter using XML, JSON or Java.

Java

email.config(
  ExtentEmailReporterConfig.builder()
    .documentTitle("MyReport")
    .build()
);

// or:

ExtentEmailReporter email = new ExtentEmailReporter("email.html");
email.config().setDocumentTitle("MyReport");

XML

<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
  <configuration>

    <!-- document encoding -->
    <!-- defaults to UTF-8 -->
    <encoding>UTF-8</encoding>

    <!-- title of the document -->
    <documentTitle>Extent Framework</documentTitle>

    <!-- report name - displayed at top-nav -->
    <reportName>Build 1</reportName>

    <!-- timestamp format -->
    <timeStampFormat>MMM dd, yyyy HH:mm:ss</timeStampFormat>

  </configuration>
</extentreports>
final File CONF = new File("config/email-config.xml");
ExtentEmailReporter email = new ExtentEmailReporter("target/email/email.html");
email.loadXMLConfig(CONF);

JSON

Version 4 and earlier had the ability to consume configuration-XML files, a functionality that remained unchanged in v5.0. External configuration can now be loaded via JSON also, as demonstrated below:

{
  "encoding": "utf-8",
  "documentTitle": "ExtentReports",
  "reportName": "ExtentReports",
  "timeStampFormat": "MMM dd, yyyy HH:mm:ss a"
}
final File CONF = new File("config/email-config.json");
ExtentEmailReporter email = new ExtentEmailReporter("target/email/email.html");
email.loadJSONConfig(CONF);