Skip to content

DevExpress-Examples/asp-net-core-dashboard-mailkit-export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dashboard for ASP.NET Core - How to send a email with the exported Dashboard document using MailKit

This example demonstrates how to email the exported Dashboard document (PDF in this example) with the MailKit cross-platform mail client library. In this example we handle the ViewerApiExtension.onDashboardTitleToolbarUpdated event to add a custom Email button to the Dashboard Title. Once the the end-user clicks the button we send and $.ajax POST request to the server using the technique from the following code example to pass the dashboard's ID and State from the client side to the server: Dashboard for MVC - How to implement server-side export.

On the server side we accept the callback and its parameters in the IndexModel.OnPostEmail method. There we use the DashboardExporter class instance to export the corresponding dashboard to the PDF document and send it as an attachment along with the MimeMessage object from the MailKit library.

Note that we use the Ethereal Email fake SMTP server to test the email sending. You can replace authentication parameters passed to the SmtpClient.Connect and SmtpClient.Authenticate methods with parameters that correspond to your email server.

The resulting dashboard looks as follows:

Files to Look at

Documentation

More Examples

About

This example demonstrates how to email a dashboard with the MailKit email client library.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5