Example #1
0
        public ImapStore(SslStream ssl, string folder)
        {
            this.ssl    = ssl;
            this.folder = folder;

            Imap.Send(ssl, $"$ SELECT {folder}");
        }
Example #2
0
        public int Store(TextReader reader)
        {
            string content  = reader.ReadToEnd();
            string response = Imap.Send(ssl, $"$ APPEND {folder} {{{content.Length}}}\n" + content);
            string id       = Regex.Match(response, @"\[APPENDUID \d+ (\d+)\]", RegexOptions.Multiline).Groups[1].Value;

            return(Convert.ToInt32(id));
        }
Example #3
0
        public IEnumerable <int> List()
        {
            string response = Imap.Send(ssl, "$ UID SEARCH ALL");
            var    list     = response.Split(new[] { Environment.NewLine }, StringSplitOptions.None)
                              .First()
                              .Split(' ')
                              .Skip(2)
                              .Select(i => Convert.ToInt32(i))
                              .ToArray();

            return(list);
        }
Example #4
0
        public TextReader Get(int id)
        {
            string mail = Imap.Send(ssl, $"$ UID FETCH {id} (RFC822)");

            return(new StringReader(mail));
        }
Example #5
0
        public void Delete(int id)
        {
            string response = Imap.Send(ssl, @$ "$ uid store {id} +FLAGS (\Deleted)");

            response = Imap.Send(ssl, @$ "$ EXPUNGE");
        }