How to retrieve Email server smtp information in Smart Client context?

Hi all!

In Smart Client context we would like to send an Email considering the smtp configuration made in the system. How can we access the data ? If it is not possible in the Smart Client context, would it be feasible to send a message to the Event Server and send the Email from there? How would we access the smtp data from there?

Thanks

Daniel

You can get the setup using the Configuration API. It doesn’t matter if you have a Smart Client plugin, a standalone app, an Event Server plugin, it works in all environments.

A snippet of code..

private void GetNotificationProfiles()
{
    ManagementServer ms = new ManagementServer(EnvironmentManager.Instance.MasterSite.ServerId);
    var mailNotificationProfiles = ms.MailNotificationProfileFolder.MailNotificationProfiles;
    foreach (var mailNotificationProfile in mailNotificationProfiles)
    {
        label1.Text += mailNotificationProfile.DisplayName + Environment.NewLine;
    }
    var mailServerSettingsConfigItem = ms.ToolOptionFolder.ToolOptions.FirstOrDefault(x => x.DisplayName.Equals("Mail server settings"));
    var mailServerSettings = mailServerSettingsConfigItem as ToolOptionMailServer;            
    label1.Text += mailServerSettings.SmtpServer + Environment.NewLine;
}

This works perfectly!

Thanks Bo!