A newer version of this page is available. Switch to the current version.

Email Reports

  • 2 minutes to read

This document describes the main capabilities for sending an exported report by e-mail automatically.


A code example illustrating how to e-mail a report is available at How to dynamically send a report via e-mail as a PDF.

To export a report to a MailMessage object containing an HTML representation of report contents, use the XtraReport.ExportToMail method. After a mail message is generated, you can initialize SmtpClient and call its SmtpClient.Send method to send the message.

To control how the current document is exported and sent via e-mail from the Print Preview, use the ExportOptions.Email property that returns a EmailOptions class descendant.

The EmailOptions class provides functionality for sending the exported report to several recipients. The EmailOptions.AdditionalRecipients property provides access to the collection of email recipients. This property returns a RecipientCollection object.

The following properties and methods are exposed by the RecipientCollection class.

To add or insert a new recipient to the AdditionalRecipients collection, use the EmailOptions.AddRecipient or EmailOptions.InsertRecipient methods, respectively. These methods take a Recipient as input.

The Recipient class is used to contain the recipient settings. The following properties exposed by this class allow you to customize the main recipient settings.

using DevExpress.XtraPrinting;
// ...

private void button1_Click(object sender, EventArgs e) {
    XtraReport1 report = new XtraReport1();

    // Add an array of recipients to the collection. 
    Recipient[] array = new Recipient[] {
        new Recipient("FirstRecipient@somewhere.com", "First Recipient", RecipientFieldType.TO),
        new Recipient("SecondRecipient@somewhere.com", "Second Recipient", RecipientFieldType.TO), 
        new Recipient("CopyRecipient@somewhere.com", "Copy Recipient", RecipientFieldType.CC)
See Also