private void buttonAddBlockedAttachment_Click(object sender, EventArgs e)
{
formBlockedAttachment blockedDlg = new formBlockedAttachment();
if (blockedDlg.ShowDialog() == DialogResult.OK)
{
hMailServer.Settings settings = APICreator.Application.Settings;
hMailServer.AntiVirus antiVirusSettings = settings.AntiVirus;
hMailServer.BlockedAttachments attachments = antiVirusSettings.BlockedAttachments;
hMailServer.BlockedAttachment ba = attachments.Add();
blockedDlg.SaveProperties(ba);
ba.Save();
Marshal.ReleaseComObject(ba);
Marshal.ReleaseComObject(settings);
Marshal.ReleaseComObject(antiVirusSettings);
Marshal.ReleaseComObject(attachments);
}
ListBlockedAttachments();
}