public void OnDeleteObject(object sender, EventArgs args) { if (Utility.AskDeleteItem(_serverName)) { hMailServer.SURBLServers surblServers = APICreator.SURBLServers; surblServers.DeleteByDBID(_serverID); Marshal.ReleaseComObject(surblServers); Instances.MainForm.RefreshParentNode(); } }
protected override void DeleteItems(List <ListViewItem> items) { hMailServer.SURBLServers surblServers = GetSurblServers(); foreach (var item in items) { int id = Convert.ToInt32(item.Tag); surblServers.DeleteByDBID(id); } Marshal.ReleaseComObject(surblServers); }
public void DisableSpamProtection() { hMailServer.AntiSpam antiSpam = _settings.AntiSpam; if (antiSpam.SpamMarkThreshold != 10000) { antiSpam.SpamMarkThreshold = 10000; } if (antiSpam.SpamDeleteThreshold != 10000) { antiSpam.SpamDeleteThreshold = 10000; } if (antiSpam.CheckHostInHelo != false) { antiSpam.CheckHostInHelo = false; } if (antiSpam.GreyListingEnabled != false) { antiSpam.GreyListingEnabled = false; } if (antiSpam.BypassGreylistingOnMailFromMX != false) { antiSpam.BypassGreylistingOnMailFromMX = false; } if (antiSpam.SpamAssassinEnabled != false) { antiSpam.SpamAssassinEnabled = false; } if (antiSpam.TarpitCount != 0) { antiSpam.TarpitCount = 0; } if (antiSpam.TarpitDelay != 0) { antiSpam.TarpitDelay = 0; } if (antiSpam.UseMXChecks != false) { antiSpam.UseMXChecks = false; } if (antiSpam.UseSPF != false) { antiSpam.UseSPF = false; } if (antiSpam.MaximumMessageSize != 1024) { antiSpam.MaximumMessageSize = 1024; } if (antiSpam.DKIMVerificationEnabled != false) { antiSpam.DKIMVerificationEnabled = false; } antiSpam.WhiteListAddresses.Clear(); for (int i = 0; i < antiSpam.DNSBlackLists.Count; i++) { hMailServer.DNSBlackList list = antiSpam.DNSBlackLists[i]; if (list.Active) { list.Active = false; list.Save(); } } hMailServer.DNSBlackLists dnsBlackLists = antiSpam.DNSBlackLists; while (dnsBlackLists.Count > 0) { dnsBlackLists.DeleteByDBID(dnsBlackLists[0].ID); } hMailServer.SURBLServers surblServers = antiSpam.SURBLServers; for (int i = surblServers.Count - 1; i >= 0; i--) { if (surblServers[i].DNSHost != "multi.surbl.org") { surblServers.DeleteByDBID(surblServers[i].ID); } else { surblServers[i].Active = false; } } if (surblServers.Count == 0) { hMailServer.SURBLServer surblServer = surblServers.Add(); surblServer.Active = false; surblServer.DNSHost = "multi.surbl.org"; surblServer.RejectMessage = "Nope"; surblServer.Score = 5; surblServer.Save(); } hMailServer.IncomingRelays incomingRelays = _settings.IncomingRelays; while (incomingRelays.Count > 0) { incomingRelays.DeleteByDBID(incomingRelays[0].ID); } antiSpam.ClearGreyListingTriplets(); }