Ejemplo n.º 1
0
 internal void SetContentType(System.Net.Mime.ContentType contentType)
 {
     this._contentType           = contentType;
     this._contentType.MediaType = MimeReader.GetMediaType(contentType.MediaType);
     this._mediaMainType         = MimeReader.GetMediaMainType(contentType.MediaType);
     this._mediaSubType          = MimeReader.GetMediaSubType(contentType.MediaType);
 }
Ejemplo n.º 2
0
        public MailMessageEx Top(int messageId, int lineCount)
        {
            if (messageId < 1)
            {
                throw new ArgumentOutOfRangeException("messageId");
            }

            if (lineCount < 0)
            {
                throw new ArgumentOutOfRangeException("lineCount");
            }

            RetrResponse response;

            using (TopCommand command = new TopCommand(_clientStream, messageId, lineCount))
            {
                response = ExecuteCommand <RetrResponse, TopCommand>(command);
            }

            MimeReader    reader  = new MimeReader(response.MessageLines);
            MimeEntity    entity  = reader.CreateMimeEntity();
            MailMessageEx message = entity.ToMailMessageEx();

            message.Octets        = response.Octets;
            message.MessageNumber = messageId;
            return(entity.ToMailMessageEx());
        }
Ejemplo n.º 3
0
 public MimeEntity()
 {
     this._children       = new List <MimeEntity>();
     this._headers        = new NameValueCollection();
     this._contentType    = MimeReader.GetContentType(string.Empty);
     this._parent         = null;
     this._encodedMessage = new StringBuilder();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Retrs the specified message.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>A MimeEntity for the requested Pop3 Mail Item.</returns>
        public MimeEntity RetrMimeEntity(Pop3ListItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (item.MessageId < 1)
            {
                throw new ArgumentOutOfRangeException("item.MessageId");
            }

            RetrResponse response;

            using (RetrCommand command = new RetrCommand(_clientStream, item.MessageId))
            {
                response = ExecuteCommand <RetrResponse, RetrCommand>(command);
            }

            MimeReader reader = new MimeReader(response.MessageLines);

            return(reader.CreateMimeEntity());
        }
Ejemplo n.º 5
0
        private void AddChildEntity(MimeEntity entity, Queue <string> lines)
        {
            MimeReader reader = new MimeReader(entity, lines);

            entity.Children.Add(reader.CreateMimeEntity());
        }