private string DecodeBase64(string code, string charset) //charset 为邮件内容字符集,空则默认为utf-8
{
if (encode == "")
{
encode = "utf-8";
}
string decode = "";
string st = code + "000"; //
string strcode = st.Substring(0, (st.Length / 4) * 4);
byte[] bytes = Convert.FromBase64String(strcode);
try
{
decode = System.Text.Encoding.GetEncoding(charset).GetString(bytes);
}
catch
{
decode = code;
}
return decode;
}
{
if (encode == "")
{
encode = "utf-8";
}
string decode = "";
string st = code + "000"; //
string strcode = st.Substring(0, (st.Length / 4) * 4);
byte[] bytes = Convert.FromBase64String(strcode);
try
{
decode = System.Text.Encoding.GetEncoding(charset).GetString(bytes);
}
catch
{
decode = code;
}
return decode;
}