protected static List <SmtpDomainWithSubdomains> GetRecipientDomains(TenantOutboundConnector outboundConnector, bool addWildcard)
        {
            IEnumerable <SmtpDomainWithSubdomains> domains = null;

            if (outboundConnector != null && outboundConnector.RecipientDomains != null)
            {
                domains = outboundConnector.RecipientDomains;
            }
            return(HybridMailflowTaskBase.GetRecipientDomains(domains, addWildcard));
        }
Exemple #2
0
        private List <CommandParameter> GetOutboundConnectorParameters(bool isNew)
        {
            List <CommandParameter> list = new List <CommandParameter>();

            if (this.CentralizedTransportEnabled != null || this.OutboundDomains != null)
            {
                bool addWildcard = false;
                if (this.CentralizedTransportEnabled != null)
                {
                    addWildcard = this.CentralizedTransportEnabled.Value;
                }
                else if (base.OriginalInboundConnector != null && base.OriginalOutboundConnector != null)
                {
                    HybridMailflowConfiguration hybridMailflowConfiguration = HybridMailflowTaskBase.ConvertToHybridMailflowConfiguration(base.OriginalInboundConnector, base.OriginalOutboundConnector);
                    addWildcard = (hybridMailflowConfiguration.CentralizedTransportEnabled != null && hybridMailflowConfiguration.CentralizedTransportEnabled.Value);
                }
                if (this.OutboundDomains != null && HybridMailflowTaskBase.IsRecipientDomainsWildcard(this.OutboundDomains))
                {
                    addWildcard = true;
                }
                List <SmtpDomainWithSubdomains> value = (this.OutboundDomains != null) ? HybridMailflowTaskBase.GetRecipientDomains(this.OutboundDomains, addWildcard) : HybridMailflowTaskBase.GetRecipientDomains(base.OriginalOutboundConnector, addWildcard);
                list.Add(new CommandParameter("RecipientDomains", value));
            }
            if (this.CentralizedTransportEnabled != null && this.CentralizedTransportEnabled.Value)
            {
                list.Add(new CommandParameter("RouteAllMessagesViaOnPremises", this.CentralizedTransportEnabled.Value));
            }
            if (this.OnPremisesFQDN != null)
            {
                list.Add(new CommandParameter("SmartHosts", this.OnPremisesFQDN.ToString()));
                list.Add(new CommandParameter("UseMxRecord", false));
            }
            if (this.CertificateSubject != null)
            {
                list.Add(new CommandParameter("TlsDomain", this.CertificateSubject));
            }
            if (this.SecureMailEnabled != null)
            {
                list.Add(new CommandParameter("TlsSettings", this.SecureMailEnabled.Value ? new TlsAuthLevel?(TlsAuthLevel.DomainValidation) : null));
            }
            if (isNew)
            {
                if (base.OrganizationName != null)
                {
                    list.Add(new CommandParameter("Organization", base.OrganizationName));
                }
                list.Add(new CommandParameter("Name", "Hybrid Mail Flow Outbound Connector"));
                list.Add(new CommandParameter("Comment", Strings.HybridMailflowOutboundConnectorComment));
                list.Add(new CommandParameter("Enabled", true));
                list.Add(new CommandParameter("ConnectorType", "OnPremises"));
                list.Add(new CommandParameter("ConnectorSource", "HybridWizard"));
                list.Add(new CommandParameter("CloudServicesMailEnabled", true));
            }
            else
            {
                list.Add(new CommandParameter("Identity", base.OriginalOutboundConnector.Identity));
            }
            return(list);
        }