下面的代码适用于 CSV 文件,但是当我们使用相同的代码读取 excel 文件时,它会在文件中返回不同的字母
foreach (MimeAttachment attach in msg.Attachments)
{
if (attach.Filename != "")
{
//read data from attachment
string myString = attach.Body.Replace("=\r\n", ""); //to eliminate the '=\r\n' from email attachemnt
Byte[] b = GetBytes(myString);
// save attachment to disk
System.IO.MemoryStream mem = new System.IO.MemoryStream(b, false);
FileStream outStream = new FileStream(DownloadFilePath + "\\" + attach.Filename, FileMode.Create);
mem.WriteTo(outStream);
mem.Close();
outStream.Flush();
outStream.Close();
}
}
前任:
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAAiwAAAAAAAAAA
EAAAjQAAAAEAAAD+////AAAAAIgAAACMAAAA////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////8J
CBAAAAYFAGcyzQfJgAEABgYAAOEAAgCwBMEAAgAAAOIAAABcAHAACQAAYXNoYWFyIE0uICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg