發郵件中發附件那塊代碼如下:
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
如何發送才能正確顯示中文附件名?
attachment.NameEncoding = Encoding.GetEncoding("GB2312");
http://blog.csdn.net/joeblackzqq/article/details/2045680