Ejemplo n.º 1
0
        /// <summary>
        /// Gets the ready made body part for a mail message as TextPart
        /// </summary>
        public override MimeEntity GetBodyPart()
        {
            var plainTextPart = new TextPart("plain");

            plainTextPart.SetText(CharacterEncoding, _plainText);
            plainTextPart.ContentTransferEncoding = TextTransferEncoding;

            plainTextPart.ContentType.Charset = Tools.GetMimeCharset(CharacterEncoding); // RFC 2045 Section 5.1 - http://www.ietf.org;
            plainTextPart.ContentId           = MimeUtils.GenerateMessageId();

            return(plainTextPart);
        }
Ejemplo n.º 2
0
 private void SetTextAndBinarayAttachmentDefaults(Encoding characterEncoding, ContentEncoding textTransferEncoding, ContentEncoding binaryTransferEncoding)
 {
     if (_attachment.ContentType.MimeType.ToLower().StartsWith("text/"))
     {
         _attachment.ContentType.Charset     = Tools.GetMimeCharset(characterEncoding);
         _attachment.ContentTransferEncoding = textTransferEncoding;
     }
     else
     {
         _attachment.ContentType.Charset     = null;
         _attachment.ContentTransferEncoding = binaryTransferEncoding;
     }
 }