Exemplo n.º 1
0
        public override MailModel GetMail(Int32 index)
        {
            String uid = Instruction.UIDLResponse(index).Split(' ')[2];

            response = Instruction.RETRResponse(index);

            System.Text.StringBuilder headSb = new System.Text.StringBuilder();
            while (true)
            {
                response = Instruction.ReadResponse();
                if (response == emptyBoundary)
                {
                    break;
                }
                else
                {
                    headSb.AppendLine(response);
                }
            }
            System.Text.StringBuilder bodySb = new System.Text.StringBuilder();
            while (true)
            {
                response = Instruction.ReadResponse();
                if (response == pointBoundary)
                {
                    break;
                }
                else
                {
                    bodySb.AppendLine(response);
                }
            }
            return(ReceiveHelper.GetMail(uid, headSb.ToString(), bodySb.ToString()));
        }
Exemplo n.º 2
0
        public override MailModel GetMail(int index)
        {
            response = Instruction.FETCHResponse(index, FetchType.UID);
            String uid = Regex.Match(response, IMAPHelper.UIDPattern).Groups["uid"].ToString();

            response = Instruction.FETCHResponse(index, FetchType.RFC822_HEADER);
            String head = Regex.Match(response, IMAPHelper.FetchMailPattern).Groups["body"].ToString();

            response = Instruction.FETCHResponse(index, FetchType.RFC822_TEXT);
            String body = Regex.Match(response, IMAPHelper.FetchMailPattern).Groups["body"].ToString();

            return(ReceiveHelper.GetMail(uid, head, body));
        }