New to Telerik Reporting? Download free 30-day trial

Using Send Mail Message Functionality in Native Blazor Report Viewer

The native Blazor Report Viewer provides the capability to send the currently displaced report in the specified document format with an e-mail message.

Enabling the send mail message functionality

By default, the send mail message button is hidden. This is because the SendMailMessage (or the respective method for ServiceStack, ASP.NET Core, etc.) should be implemented first so that the e-mail messages can be sent server-side.

Web browsers cannot initiate the sending of e-mail messages containing attachments as a security measure. More information on how to implement the necessary server-side code is available at Implement Send Mail Message.

Once ready, the send mail message toolbar button can be enabled through the EnableSendEmail initialization option.

<ReportViewer 
...
EnableSendEmail="false" />

Send Mail Message Dialog

The Send Mail Message dialog is a Telerik Blazor UI Window widget, that stays on top of the report viewer.

Send Email Message Dialog that pops up after clicking on the Send Email button

Pre-configuring the Send Mail Message Dialog Settings

The settings are populated from a SendEmailDialogSettings tag, that sits inside the ReportViewerSettings parent tag. The values are used only for the initial population of the fields. Two-way binding is not supported for those settings.

Markup Example

<ReportViewer
    ServiceUrl="/api/reports"
    @bind-ReportSource="@ReportSource"
    EnableSendEmail="true">
    <ReportViewerSettings>
        <SendEmailDialogSettings
            From="from@mail.com"
            To="to@mail.com"
            Cc="Cc"
            Subject=""
            Body=""
            Format="CSV">
        </SendEmailDialogSettings>
    </ReportViewerSettings>
</ReportViewer>

Setting Fields

  • From (Required) - E-mail address used for the MailMessage FROM value.
  • To (Required) - E-mail address used for the MailMessage TO value. Multiple addresses are not supported.
  • CC (Optional) - E-mail addresses used for the MailMessage CC value. Use ,(comma) to separate multiple e-mail addresses.
  • Subject (Optional) - The MailMessage subject.
  • Body (Optional) - The MailMessage body.
  • Format - If empty, or not present in the list of supported formats by the report, the first available format from the list is chosen instead. Uses non-localized values, such as PDF, CSV etc.

See Also

In this article