using System.ComponentModel; namespace FastReport.Export.Email { /// /// Contains the email account settings such as host, email address, name. /// /// /// You have to set up at least the and properties. If your /// host requires authentication, provide the and /// properties as well. /// Set property to true if you want to use default email client /// such as Outlook to send an email. In this case, all other properties will be ignored. /// [TypeConverter(typeof(FastReport.TypeConverters.FRExpandableObjectConverter))] public class EmailSettings { #region Fields private string address; private string name; private string messageTemplate; private string host; private int port; private string userName; private string password; private bool enableSSL; private bool allowUI; private bool useMAPI; #endregion #region Properties /// /// Gets or sets the sender's email address. /// /// /// This property contains your email address (for example, "john@site.com"). /// public string Address { get { return address; } set { address = value; } } /// /// Gets or sets the sender's name. /// /// /// This property contains your name (for example, "John Smith"). /// public string Name { get { return name; } set { name = value; } } /// /// Gets or sets the template that will be used to create a new message. /// public string MessageTemplate { get { return messageTemplate; } set { messageTemplate = value; } } /// /// Gets or sets the SMTP host name or IP address. /// public string Host { get { return host; } set { host = value; } } /// /// Gets or sets the SMTP port. /// /// /// The default value for this property is 25. /// [DefaultValue(25)] public int Port { get { return port; } set { port = value; } } /// /// Gets or sets the user name. /// /// /// Specify the and properties if your host requires /// authentication. /// public string UserName { get { return userName; } set { userName = value; } } /// /// Gets or sets the password. /// /// /// Specify the and properties if your host requires /// authentication. /// public string Password { get { return password; } set { password = value; } } /// /// Gets or sets a value that determines whether to enable the SSL protocol. /// [DefaultValue(false)] public bool EnableSSL { get { return enableSSL; } set { enableSSL = value; } } /// /// Gets or sets a value that determines whether the account setting page /// in the "Send Email" window is enabled. /// [DefaultValue(true)] public bool AllowUI { get { return allowUI; } set { allowUI = value; } } /// /// Gets or sets a value that determines whether to use MAPI instead of SMTP when sending an email. /// [DefaultValue(false)] public bool UseMAPI { get { return useMAPI; } set { useMAPI = value; } } #endregion #region Public Methods /// /// Copies email settings from another source. /// /// Source to copy settings from. public void Assign(EmailSettings source) { Address = source.Address; Name = source.Name; MessageTemplate = source.MessageTemplate; Host = source.Host; Port = source.Port; UserName = source.UserName; Password = source.Password; EnableSSL = source.EnableSSL; AllowUI = source.AllowUI; UseMAPI = source.UseMAPI; } #endregion /// /// Initializes a new instance of the class with default settings. /// public EmailSettings() { address = ""; name = ""; messageTemplate = ""; host = ""; port = 25; userName = ""; password = ""; allowUI = true; } } }