pop读取邮件头乱码
有的邮件内容是base64编码的。 需要手动解码。
string patten = @"\=\?(?<Encoding>.*?)\?(?<Base>\D+?)\?(?<Content>.*?)\?\="; var m = Regex.Match(line, patten); if (m.Success) { string codeName = m.Groups["Encoding"].Value; string baseCode = m.Groups["Base"].Value; string content = m.Groups["Content"].Value; if (baseCode.ToUpperInvariant() == "B") { //support base64 only, other do nothing string tmp = Encoding.GetEncoding(codeName).GetString(Convert.FromBase64String(content)); line = Regex.Replace(line, patten, tmp); } }