예제 #1
0
        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);
        }
예제 #2
0
 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;
 }
예제 #3
0
        public static RoutingDomain GetDomainPart(RoutingAddress address)
        {
            string domainPart = address.DomainPart;

            if (domainPart != null)
            {
                return(new RoutingDomain(domainPart));
            }
            return(RoutingDomain.Empty);
        }
예제 #4
0
 public abstract bool IsSafeSender(RoutingAddress senderAddress);
 public abstract bool Contains(RoutingAddress address);
 public AcceptedDomain Find(RoutingAddress smtpAddress)
 {
     return(this.Find(smtpAddress.DomainPart));
 }
예제 #7
0
 public abstract void Add(RoutingAddress address);
예제 #8
0
 public abstract AddressBookEntry Find(RoutingAddress smtpAddress);
예제 #9
0
 public abstract bool IsInternalTo(RoutingAddress address, RoutingAddress organizationAddress);
예제 #10
0
 public abstract bool IsInternalTo(RoutingAddress address, RoutingDomain organizationDomain);
예제 #11
0
 public abstract bool IsInternal(RoutingAddress address);
예제 #12
0
 public abstract bool IsSameRecipient(RoutingAddress proxyAddressA, RoutingAddress proxyAddressB);
예제 #13
0
 public abstract bool IsMemberOf(RoutingAddress recipientSmtpAddress, RoutingAddress groupSmtpAddress);
예제 #14
0
 public abstract bool IsSafeRecipient(RoutingAddress recipientAddress);
예제 #15
0
 public abstract int Remove(RoutingAddress address);
예제 #16
0
 public abstract bool IsBlockedSender(RoutingAddress senderAddress);
예제 #17
0
 public RemoteDomain Find(RoutingAddress smtpAddress)
 {
     return(this.Find(smtpAddress.DomainPart));
 }