开发者

How do you specify Content-Type Name and Content-Disposition Filename using Attachment and LinkedResource?

开发者 https://www.devze.com 2023-02-07 07:34 出处:网络
Emails generated using System.Net.Mail.Attachment and System.Net.Mail.LinkedResource contain MIME parts. The question is how to specify the Content-Type Name and Content-Disposition Filename values an

Emails generated using System.Net.Mail.Attachment and System.Net.Mail.LinkedResource contain MIME parts. The question is how to specify the Content-Type Name and Content-Disposition Filename values and encodings for the headers in those MIME parts.

Attachment, Content-Type Name:

Presumably the value can be specified using the Attachment.Nam开发者_JAVA百科e property or the ContentType.Name property. Are these two properties synonymous or is it better to use one in preference to the other? If they are synonymous then why does the Attachment.Name property exist? Presumably the encoding can be specified using the Attachment.NameEncoding property but why isn’t there a corresponding ContentType.NameEncoding property?

Attachment, Content-Disposition Filename:

The value is obviously specified using the ContentDisposition.Filename property but how can the encoding be specified?

LinkedResource, Content-Type Name:

The value can only be specified using the ContentType.Name property but how can the encoding be specified? Also, if there is some good reason to have an Attachment.Name property then why isn’t there a corresponding LinkedResource.Name property?

LinkedResource, Content-Disposition Filename:

A LinkedResource does not have a ContentDisposition so how can the value or the encoding be specified?


This probably follow the same convention than in HTTP.

The encoding, called charset is defined in the Content-Type like this :

 Content-Type: text/plain; charset=utf-8

Note the space before charset, this is part of the standard.

Use Content-Disposition of the attachment to specify filename then.

0

精彩评论

暂无评论...
验证码 换一张
取 消