Crystalbyte.Equinox.Imap.ImapClient.Append C# (CSharp) Метод

Append() публичный Метод

The APPEND command appends the literal argument as a new message to the end of the specified destination mailbox. http://tools.ietf.org/html/rfc3501#section-6.3.11
public Append ( string mailboxName, Message message, MessageFlags flags = (MessageFlags)0x0000 ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse
mailboxName string The name of the malbox to insert the message.
message Message The message to append.
flags MessageFlags Sets the flags of the message. This is optional.
Результат Crystalbyte.Equinox.Imap.Responses.ImapResponse
        public ImapResponse Append(string mailboxName, Message message, MessageFlags flags = (MessageFlags) 0x0000)
        {
            // we need to convert non ASCII names according to IMAP specs.
            // http://tools.ietf.org/html/rfc2060#section-5.1.3
            var name = MailboxNameEncoder.Encode(mailboxName);

            var mime = message.ToMime();
            var size = mime.Length;
            var flagString = flags == 0x0000 ? string.Empty : string.Format(" ({0})", flags.ToMimeFormat());
            var text = string.Format("APPEND {0}{1} {{{2}}}", name, flagString, size);
            var reader = SendAndReceive(new ImapCommand(text));

            if (reader.IsContinuation) {
                var finalReader = SendAndReceive(new BlankImapCommand(mime));

                var validResponse = new ImapResponse();
                validResponse.Parse(finalReader);
                return validResponse;
            }

            var invalidResponse = new ImapResponse();
            invalidResponse.Parse(reader);
            return invalidResponse;
        }