Send a Report via Email

This example shows how to send report via Email using the HTML Viewer. For this, you need to enable the Send Email button in the Viewer options and add the onEmailReport event handler:

var options = new Stimulsoft.Viewer.StiViewerOptions();
options.toolbar.showSendEmailButton = true;

...

viewer.onEmailReport = function (event) {
<?php StiHelper::createHandler(); ?>
}


On the PHP server side you need to fill your Email account options. This should be done in the $handler->onEmailReport event in the handler.php file:

$handler->onEmailReport = function ($event) {
$event->settings->from = "******@gmail.com";
$event->settings->host = "smtp.gmail.com";
$event->settings->login = "******";
$event->settings->password = "******";
};


In the screenshot below you can see the result of the sample code.

Send Email