hMailServer.Administrator.ucStatus.DisplayWarnings C# (CSharp) Method

DisplayWarnings() private method

private DisplayWarnings ( ) : void
return void
        private void DisplayWarnings()
        {
            listWarnings.Items.Clear();

            hMailServer.Settings settings = APICreator.Application.Settings;

            if (settings.HostName.Length == 0)
                AddWarning("W001", Strings.Localize("High"), Strings.Localize("You haven't specified the public host name for this computer in the SMTP settings."));

            if (settings.DenyMailFromNull)
                AddWarning("W002", Strings.Localize("High"), Strings.Localize("You have configured hMailServer not to allow email with empty sender address. Many email server will not accept email from your server with this configuration."));

            int autobanRanges = 0;

            // Check if External to external is enabled in any of the IP ranges.
            hMailServer.SecurityRanges ranges = settings.SecurityRanges;
            for (int i = 0; i < ranges.Count; i++)
            {
                hMailServer.SecurityRange range = ranges[i];

                if (range.AllowDeliveryFromRemoteToRemote && !range.RequireSMTPAuthExternalToExternal)
                {
                    string warning =
                       Strings.Localize("hMailServer is configured to allow deliveries from external to external accounts in the IP range %s. This may make the server vulnerable to spam. It is recommended that you disable this option.");

                    warning = warning.Replace("%s", range.Name);

                    AddWarning("W003", Strings.Localize("Critical"), warning);
                }

               if (range.LowerIP == "127.0.0.1" && range.UpperIP == "127.0.0.1" && range.Expires)
               {
                  string warning =
                       Strings.Localize("Localhost is currently banned in the IP ranges.");

                  AddWarning("W004", Strings.Localize("High"), warning);
               }

               if (range.Expires)
                  autobanRanges += 1;

               Marshal.ReleaseComObject(range);
            }

               if (autobanRanges > 0)
               {
              string warning =
                  Strings.Localize("There is a total of %s auto-ban IP ranges.");

              warning = warning.Replace("%s", autobanRanges.ToString());

              AddWarning("W005", Strings.Localize("Medium"), warning);
               }

            Marshal.ReleaseComObject(ranges);
            Marshal.ReleaseComObject(settings);
        }