private static bool TryParse(string domainRepresentation, out string domain) { domain = string.Empty; if (string.IsNullOrEmpty(domainRepresentation)) { return(false); } int num = domainRepresentation.IndexOf(RoutingDomain.Separator); if (num != -1) { string text = domainRepresentation.Substring(0, num); string value = domainRepresentation.Substring(num + 1); if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(value) || text.IndexOfAny(RoutingDomain.CharactersNotAllowedInType) != -1) { return(false); } if (text.Equals("smtp", StringComparison.OrdinalIgnoreCase) && !RoutingAddress.IsValidDomain(value)) { return(false); } domain = domainRepresentation; } else { if (!RoutingAddress.IsValidDomain(domainRepresentation)) { return(false); } domain = "smtp:" + domainRepresentation; } return(true); }
public RoutingDomain(string domain, string type) { if (string.Equals(type, "smtp", StringComparison.OrdinalIgnoreCase)) { if (!RoutingAddress.IsValidDomain(domain)) { throw new FormatException(string.Format("The format of the specified domain '{0}' isn't valid", domain ?? string.Empty)); } } else { if (string.IsNullOrEmpty(type)) { throw new FormatException("A null or empty routing type isn't valid"); } if (string.IsNullOrEmpty(domain)) { throw new FormatException("A null or empty domain isn't valid"); } if (type.IndexOfAny(RoutingDomain.CharactersNotAllowedInType) != -1) { throw new FormatException(string.Format("Domain type '{0}' contains at least one invalid character. You can't use the following characters when specifying domain types: '{1}'", type, RoutingDomain.CharactersNotAllowedInType)); } } this.domain = type + RoutingDomain.Separator + domain; }
public static RoutingDomain GetDomainPart(RoutingAddress address) { string domainPart = address.DomainPart; if (domainPart != null) { return(new RoutingDomain(domainPart)); } return(RoutingDomain.Empty); }
public abstract bool IsSafeSender(RoutingAddress senderAddress);
public abstract bool Contains(RoutingAddress address);
public AcceptedDomain Find(RoutingAddress smtpAddress) { return(this.Find(smtpAddress.DomainPart)); }
public abstract void Add(RoutingAddress address);
public abstract AddressBookEntry Find(RoutingAddress smtpAddress);
public abstract bool IsInternalTo(RoutingAddress address, RoutingAddress organizationAddress);
public abstract bool IsInternalTo(RoutingAddress address, RoutingDomain organizationDomain);
public abstract bool IsInternal(RoutingAddress address);
public abstract bool IsSameRecipient(RoutingAddress proxyAddressA, RoutingAddress proxyAddressB);
public abstract bool IsMemberOf(RoutingAddress recipientSmtpAddress, RoutingAddress groupSmtpAddress);
public abstract bool IsSafeRecipient(RoutingAddress recipientAddress);
public abstract int Remove(RoutingAddress address);
public abstract bool IsBlockedSender(RoutingAddress senderAddress);
public RemoteDomain Find(RoutingAddress smtpAddress) { return(this.Find(smtpAddress.DomainPart)); }