zhaochenzhao92
lv_Angle
2015-01-20 06:39
采纳率: 18.8%
浏览 2.3k

如何发送邮件中文附件名无乱码?

发邮件中发附件那块代码如下:

 private void sendAttachmentHeader(string attachment)
        {
            string contentType = "application/octet-stream";//text/plain;
            string header = "--" + boundary_pro + "\r\n"
                    + "Content-Type:" + contentType + ";;name=" + System.IO.Path.GetFileName(attachment) + "\r\n"
                    + "Content-Transfer-Encoding:base64\r\n"
                    + "Content-Disposition:attachment;filename=\"" + System.IO.Path.GetFileName(attachment) + "\"\r\n";
            socketSend(header + "\r\n");
        }

发出去的邮件收取是如果是中文显示 ???????.txt

如何发送才能正确显示中文附件名?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐