Class EmailExport
Represents the email export.
Inheritance
Implements
Namespace: FastReport.Export.Email
Assembly: FastReport.dll
Syntax
public class EmailExport : IFRSerializable
Remarks
In order to use this class, you need to set up at least the following properties: Address, Subject, Account. Use the Export property to choose the format of an attachment. If you leave it empty, the attachment will be in the .FRP format (FastReport prepared report). When you done with settings, call the SendEmail(Report[]) method to send an email.
Examples
This example demonstrates the bare minimum required to send an email.
EmailExport export = new EmailExport();
export.Account.Address = "my@address.net";
export.Account.Host = "myhost";
export.Address = "recipient@address.net";
export.Subject = "Re: analysis report";
// the report1 report must be prepared at this moment
export.SendEmail(report1);
Constructors
EmailExport()
Initializes a new instance of the EmailExport class with default settings.
Declaration
public EmailExport()
EmailExport(Report)
Initializes a new instance of the EmailExport class with default settings.
Declaration
public EmailExport(Report report)
Parameters
Type | Name | Description |
---|---|---|
Report | report |
Properties
Account
Gets the email account settings such as host, user name, password.
Declaration
public EmailSettings Account { get; set; }
Property Value
Type | Description |
---|---|
EmailSettings |
Address
Gets or sets the recipient's address.
Declaration
public string Address { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property must contain value in form "john@url.com".
CC
Gets or sets the carbon copy adresses.
Declaration
public string[] CC { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
Remarks
This property must contain an array of values in form "john@url.com".
Export
Gets or sets the export filter which will be used to export a report.
Declaration
public ExportBase Export { get; set; }
Property Value
Type | Description |
---|---|
ExportBase |
Remarks
Set this property to instance of any export filter. When you send the email, the report will be exported using that export filter.
By default, this property is set to null. In this case the report will be send in .FRP format.
MessageBody
Gets or sets the message body.
Declaration
public string MessageBody { get; set; }
Property Value
Type | Description |
---|---|
System.String |
NameAttachmentFile
Gets or sets the name attachment file.
Declaration
public string NameAttachmentFile { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Report
Gets the parent Report object
Declaration
public Report Report { get; }
Property Value
Type | Description |
---|---|
Report |
Subject
Gets or sets the subject of the message.
Declaration
public string Subject { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Deserialize(FRReader)
Deserializes the object.
Declaration
public void Deserialize(FRReader reader)
Parameters
Type | Name | Description |
---|---|---|
FRReader | reader | Reader object. |
SendEmail(Report[])
Sends an email.
Declaration
public void SendEmail(params Report[] reports)
Parameters
Type | Name | Description |
---|---|---|
Report[] | reports | Reports that will be sent as attachments. |
Remarks
Before using this method, set up the following properties (it's a bare minimum): Address, Subject, Account.
The report that you pass in this method must be prepared using the Prepare method.
Serialize(FRWriter)
Serializes the object.
Declaration
public void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer | Writer object. |
ShowDialog()
Displays the dialog box in which you can set up all parameters.
Declaration
public DialogResult ShowDialog()
Returns
Type | Description |
---|---|
System.Windows.Forms.DialogResult | true if user pressed OK button in the dialog. |