What's the correct way to name an email attachment in .NET?

There Attachment

are 3 "name" properties in the .NET class :

Attachment.Name

Attachment.ContentType.Name

Attachment.ContentDisposition.FileName

I want to send an excel file named "foo.xls". Which one should be installed? Who cares? The documents are not particularly highlighted.

+3


source to share


1 answer


The correct one to use is Attachment.Name.

The information for Attachment.ContentType.Name is

When specifying content to attach 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.



Information for Attachment.ContentDisposition.FileName -

The FileName property allows the sender to suggest a name that will be used to store the email attachment on the receiving computer. This title is just a suggestion ; the receiving system can ignore it. The name must not contain path information; any such information is ignored by the receiving computer.

+3


source







All Articles