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.
var email = new ExtentEmailReporter("Email.html");
var extent = new ExtentReports();
extent.AttachReporter(email);
Configuration
You can apply custom configuration to each reporter using XML, JSON or C#.
C#
var email = new ExtentEmailReporter("email.html");
email.Config.DocumentTitle = "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>
var email = new ExtentEmailReporter("Email.html");
email.LoadXMLConfig("config/email-config.xml");
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"
}
var email = new ExtentEmailReporter("Email.html");
email.LoadJSONConfig("config/email-config.json");