/// <summary> /// Determines whether there are any recipient-specific settings that /// mean the message should not go through mail filtering. /// </summary> /// <param name="sender">The address of the sender.</param> /// <param name="recipient">The address of the recipient.</param> /// <param name="server">The server instance.</param> /// <returns>Whether the sender is a safe sender.</returns> private bool ShouldBypassFilter(RoutingAddress sender, RoutingAddress recipient, SmtpServer server) { if (server == null || sender == null || recipient == null) { return(false); } AddressBook addressBook = server.AddressBook; if (addressBook != null) { AddressBookEntry addressBookEntry = addressBook.Find(recipient); if (addressBookEntry != null) { if (addressBookEntry.AntispamBypass || addressBookEntry.IsSafeSender(sender) || addressBookEntry.IsSafeRecipient(recipient)) { return(true); } } } return(false); }