Set Email Attachment name in C#

前端 未结 1 576
时光说笑
时光说笑 2021-02-11 12:47

I add an attachment like this:

System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(AttachmentPath);   
msg.Attachments.Add(attachment);   
         


        
1条回答
  •  Happy的楠姐
    2021-02-11 13:45

    How about:

    System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(attachmentPath);
    attachment.Name = "file.txt";  // set name here
    msg.Attachments.Add(attachment);
    

    0 讨论(0)
提交回复
热议问题