[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
   [Expand]Product Information
   [Expand]Getting Started
   [Expand]Fundamental Concepts
    [Expand]Basic Terms
    [Expand]Print Preview
      Export to PDF
      Export to HTML
      Export to MHT
      Export to Text
      Export to CSV
      Export to XLS
      Export to XLSX
      Export to RTF
      Export to DOCX
      Export to Image
      Export to MailMessage
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Export to MailMessage

This document details the export of a document to an email message represented by an instance of the System.Net.Mail.MailMessage class.

Note that exporting a document to an email message and sending the resulting message to recipients can only be performed at run time. The resulting System.Net.Mail.MailMessage instance contains an HTML representation of the report contents optimized for transmission by email. You can then use the mail functionality of the .NET Framework to programmatically send the generated message to an arbitrary number of recipients using the required email settings.

The options that can be specified for a document exported to an email message are stored in an MailMessageExportOptions object, and can be accessed using a report's ExportOptions.MailMessage property. The MailMessageExportOptions class extends the HtmlExportOptionsBase class and provides access to a set of options common to all HTML-based export formats.

Among these options, the HtmlExportOptionsBase.ExportMode property determines the way in which a document is exported to HTML. For instance, it may be exported to a single file (with a single page header at the beginning and a single page footer at the end), or it may be exported page-by-page to either a single file or different files.

The HtmlExportOptionsBase.TableLayout property determines whether or not to use the table layout in the resulting HTML markup. If this property is set to false, the non-table layout is used instead. The table layout is recommended, as it uses a more compact and efficient markup.

The HtmlExportOptionsBase.ExportWatermarks property specifies whether or not to maintain the existing text and image watermarks of a report in the HTML markup. The following image illustrates the corresponding option in the HTML Export Options dialog.

Only report controls that do not intersect each other can be correctly exported to HTML using the table layout.
Intersecting report controls may completely break the resulting mail message layout.

To make sure that your report layout will be preserved in RTF, enable the report's DesignerOptions.ShowExportWarnings property at design time, and ensure there are no controls colored in red, which marks intersecting controls.

If you need to export a report that contains intersecting controls to an email message, use the non-table layout.

Is this topic helpful?​​​​​​​