private void CreateBody(string sLine, byte [] buffer)
        {
            MimeBodyPart mbp = null;
            if (_isMultiPart)
            {
                mbp = new MimeMultipartBody(_boundary);
            }
            else
            {
                mbp = new MimeBasicPart();
            }
            _body = mbp;
            //Set content type
            string charset = null;
            if (_headers["content-type"] != null)
            {
                _body.ContentType = _headers["content-type"].Value;
                if (_headers["content-type"].Parameters["charset"] != null)
                {
                    charset = _headers["content-type"].Parameters["charset"].Value;
                }
            }

            //Set content type
            if (_headers["content-transfer-encoding"] != null)
            {
                _body.Encoding = MimeBodyPart.GetMimeEncoding(_headers["content-transfer-encoding"].Value);
            }

            //Set text
            if (sLine != null)
            {
                if (_body.Encoding == MimeBodyPart.MimeEncoding.Binary)
                {
                    //Copy buffer
                    _body.Buffer = buffer;
                }
                else if (_body.Encoding == MimeBodyPart.MimeEncoding.Base64)
                {
                    _body.Buffer = Convert.FromBase64String(sLine);
                }
                else
                {
                    if (charset != null)
                    {
                        _body.SetText(sLine, MimeBodyPart.GetMimeCharset(charset));
                    }
                    else
                    {
                        _body.SetText(sLine);
                    }
                }
            }
        }
 /// <summary>
 /// Set body of the message from plain text
 /// </summary>
 /// <param name="plainText">plain text to set the body</param>
 public void SetBodyFromPlainText(string plainText)
 {
     if (_body == null)
     {
         _body = new MimeBasicPart();
     }
     _body.SetText(plainText);
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public MimeMessage(MimeBodyPart body)
 {
     _body = body;
 }
 /// <summary>
 /// Set body of the message from binary byte array
 /// </summary>
 /// <param name="buffer"></param>
 public void SetBodyFromBinary(byte [] buffer)
 {
     if (_body == null)
     {
         _body = new MimeBasicPart();
     }
     _body.Buffer = buffer;
 }
 /// <summary>
 /// Deletes the body.
 /// </summary>
 public void DeleteBody()
 {
     _body = null;
 }
 /// <summary>
 /// Append the given part to the body
 /// </summary>
 /// <param name="part"></param>
 public void AppendPart(MimeMessage part)
 {
     if (_isMultiPart)
     {
         if (_body == null)
         {
             _body  = new MimeMultipartBody();
         }
         ((MimeMultipartBody)_body).Add(part);
     }
 }
 /// <summary>
 /// Remove the given MimeBodyPart from the collection.
 /// </summary>
 /// <param name="part">The part to remove.</param>
 public void Remove(MimeBodyPart part)
 {
     _parts.Remove(part);
 }
 /// <summary>
 /// Add a mime body part.
 /// </summary>
 /// <param name="part">The part to add.</param>
 /// <returns>The newly added part.</returns>
 public MimeBodyPart Add(MimeBodyPart part)
 {
     _parts.Add(part);
     return part;
 }