There are 3 "name" properties on the .NET Attachment
class:
Attachment.Name
Attachment.ContentType.Name
Attachment.ContentDisposition.FileName
I want to send an excel file with the name "foo.xls". Which of these should be set? What's the difference? The docs are not particularly illuminating.
The correct one to use is Attachment.Name.
Info for Attachment.ContentType.Name -
When specifying content for a Attachment as a Stream or String, you can use Name to set the name of the file that stores the content on the recipient's system
Info for Attachment.ContentDisposition.FileName -
The FileName property allows the sender to suggest the name to be used to store an e-mail attachment on the recipient's computer. This name is a suggestion only ; the receiving system can ignore it. The name must not include path information; any such information is ignored by the receiving computer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.