对邮件内容编码除了有base64编码外,还有哪几种编码形式

解决方案 »

  1.   

    enum TransferEncoding枚举,用于指定电子邮件附件的 Content-Transfer-Encoding 标头信息
    其成员有:
    QuotedPrintable    将由 US-ASCII 字符集中可打印的字符组成的数据编码。 
     Base64                   将基于流的数据编码。
     SevenBit                用于不编码的数据。数据为 7 位 US-ASCII 字符,总行长不超过 1000 个字符。
     Unknown 表示传输编码未知。 TransferEncoding 枚举中的值与 Attachment.TransferEncoding 属性一起使用,指定将关联的邮件正文编码以满足 SMTP 要求。SMTP 要求传输的数据为 7 位 US-ASCII 字符,并且行长不超过 1000 个字符这个东西只是邮件传输时的字节流传输方式,我们不用管,.Net的接收相关类库会自动处理的, 我们只关心用户在写邮件的时候使用的字符集编码,如Gb2312/UTF-8==说到底,字符集编码和邮件传输字节流编码是两回事,楼主一定是弄混了,字符集编码不一致才是乱码的关键
      

  2.   

    楼主,你那个所谓的Base64编码我也给解出来了:using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;
    using System.Security.Cryptography;namespace ConsoleApplication5
    {    
        class Program
        {               
            static void Main(string[] args)
            {
                string x = "6K++56iL56CU56m277yM5oGt5L6v5Zue5aSNIA?";
                byte[] buff = Encoding.Default.GetBytes(x);
                FromBase64Transform ts = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces);
                byte[] result = ts.TransformFinalBlock(buff, 0, buff.Length);
                string s = Encoding.UTF8.GetString(result);
                Console.WriteLine(s);
            }
        }
    }
    输出: 课程研究,静候回复