public static SmtpServerCapability ParseCapability(SmtpResponseReader reader)
        {
            var capability = new SmtpServerCapability();
            while (true) {
                if (!reader.IsKnownCapability) {
                    if (reader.IsLast) {
                        break;
                    }
                    reader.ReadNextLine();
                    continue;
                }

                if (reader.Text.StartsWith("AUTH")) {
                    var sub = reader.Text.Substring(5);
                    var split = sub.Split(' ');
                    foreach (var auth in split.Select(item => string.Format("AUTH={0}", item))) {
                        if (!capability.Items.Contains(auth)) {
                            capability.Store(auth);
                        }
                    }
                } else {
                    if (!capability.Items.Contains(reader.Text)) {
                        capability.Store(reader.Text);
                    }
                }

                if (reader.IsLast) {
                    break;
                }

                reader.ReadNextLine();
            }
            return capability;
        }
Exemple #2
0
        internal SmtpResponseReader Receive(TimeSpan timeout)
        {
            var reader = new SmtpResponseReader(this, timeout);

            reader.ReadNextLine();
            return(reader);
        }
        public static SmtpServerCapability ParseCapability(SmtpResponseReader reader)
        {
            var capability = new SmtpServerCapability();

            while (true)
            {
                if (!reader.IsKnownCapability)
                {
                    if (reader.IsLast)
                    {
                        break;
                    }
                    reader.ReadNextLine();
                    continue;
                }

                if (reader.Text.StartsWith("AUTH"))
                {
                    var sub   = reader.Text.Substring(5);
                    var split = sub.Split(' ');
                    foreach (var auth in split.Select(item => string.Format("AUTH={0}", item)))
                    {
                        if (!capability.Items.Contains(auth))
                        {
                            capability.Store(auth);
                        }
                    }
                }
                else
                {
                    if (!capability.Items.Contains(reader.Text))
                    {
                        capability.Store(reader.Text);
                    }
                }

                if (reader.IsLast)
                {
                    break;
                }

                reader.ReadNextLine();
            }
            return(capability);
        }
Exemple #4
0
 internal SmtpResponseReader Receive(TimeSpan timeout)
 {
     var reader = new SmtpResponseReader(this, timeout);
     reader.ReadNextLine();
     return reader;
 }