Ejemplo n.º 1
0
        private SmtpCommandResult GetResponse()
        {
            List <SmtpCommandResultLine> l = new List <SmtpCommandResultLine>();
            String lineText = "";
            SmtpCommandResultLine currentLine = null;

            Byte[]       bb = this.GetResponseBytes(new SmtpDataReceiveContext(this.ResponseEncoding));
            StringReader sr = new StringReader(this.ResponseEncoding.GetString(bb));

            while (true)
            {
                lineText = sr.ReadLine();
                if (lineText.IsNullOrEmpty() == true)
                {
                    break;
                }

                currentLine = new SmtpCommandResultLine(lineText);
                l.Add(currentLine);
                //次の行があるかチェック
                if (currentLine.HasNextLine == false)
                {
                    break;
                }
            }
            this.SetSmtpCommandState();
            return(new SmtpCommandResult(l.ToArray()));
        }
Ejemplo n.º 2
0
        private SmtpCommandResult GetResponse()
        {
            List <SmtpCommandResultLine> l = new List <SmtpCommandResultLine>();
            String lineText = "";
            SmtpCommandResultLine CurrentLine = null;

            Byte[]       bb = this.GetResponseBytes(new SmtpDataReceiveContext(this.ResponseEncoding));
            StringReader sr = new StringReader(this.ResponseEncoding.GetString(bb));

            while (true)
            {
                lineText    = sr.ReadLine();
                CurrentLine = new SmtpCommandResultLine(lineText);
                if (CurrentLine.InvalidFormat == true)
                {
                    throw new MailClientException("Invalid format response." + Environment.NewLine + lineText);
                }
                l.Add(CurrentLine);
                //次の行があるかチェック
                if (CurrentLine.HasNextLine == false)
                {
                    break;
                }
            }
            this.SetSmtpCommandState();
            return(new SmtpCommandResult(l.ToArray()));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lines"></param>
        public SmtpCommandResult(SmtpCommandResultLine[] lines)
        {
            StringBuilder sb = new StringBuilder();
            if (lines.Length == 0)
            { throw new ArgumentException("line must not be zero length."); }

            this._StatusCode = lines[0].StatusCode;
            for (int i = 0; i < lines.Length; i++)
            {
                sb.Append(lines[i].Message);
                if (i < lines.Length - 1)
                {
                    sb.AppendLine();
                }
            }
            this._Message = sb.ToString();
        }
Ejemplo n.º 4
0
 private SmtpCommandResult GetResponse()
 {
     List<SmtpCommandResultLine> l = new List<SmtpCommandResultLine>();
     String lineText = "";
     SmtpCommandResultLine CurrentLine = null;
     Byte[] bb = this.GetResponseBytes(new SmtpDataReceiveContext(this.ResponseEncoding));
     StringReader sr = new StringReader(this.ResponseEncoding.GetString(bb));
     while (true)
     {
         lineText = sr.ReadLine();
         CurrentLine = new SmtpCommandResultLine(lineText);
         l.Add(CurrentLine);
         //次の行があるかチェック
         if (CurrentLine.HasNextLine == false)
         { break; }
     }
     this.SetSmtpCommandState();
     return new SmtpCommandResult(l.ToArray());
 }