作者magic704226 (洨魯)
看板C_Sharp
標題[問題] SmtpClient寄信,檔名想設定成中文
時間Tue Feb 10 17:38:59 2015
MailMessage myMail = new MailMessage();
SmtpClient mySmtpServer = new SmtpClient("smtp.gmail.com");
myMail.From = new MailAddress("
[email protected]", "Test Group");
myMail.To.Add("
[email protected]");
myMail.Bcc.Add("
[email protected]");
myMail.Subject = "Test";
string myFile3 = pdfPath;
Attachment myAttach3 = new Attachment(myFile3, MediaTypeNames.Application.Octet);
ContentDisposition disposition3 = myAttach3.ContentDisposition;
disposition3.FileName = "ticket.pdf"; <---------------- 想設定成中文
disposition3.CreationDate = System.IO.File.GetCreationTime(pdfPath);
disposition3.ModificationDate = System.IO.File.GetLastWriteTime(pdfPath);
disposition3.ReadDate = System.IO.File.GetLastAccessTime(pdfPath);
myMail.Attachments.Add(myAttach3);
這有沒有解啊?
我網路找很久都沒找到
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 110.26.187.95
※ 文章網址: https://webptt.com/m.aspx?n=bbs/C_Sharp/M.1423561141.A.A48.html
1F:→ konkonchou: 4.5 以上, 4.0以下太長常會出問題 02/10 20:03