Is there a way to set the ContentDisposition of a LinkedResource to be inline, ie in the case of an image?

Here's how I am building my LinkedResource right now:

            Dim img As LinkedResource = New LinkedResource(filePath)

            Dim fileType As String = ""
            Dim attName As String = "image" + fileName + "." + fileExt

            If (fileExt = "jpg" Or fileExt = "jpeg") Then
                img.ContentType.MediaType = System.Net.Mime.MediaTypeNames.Image.Jpeg
            ElseIf (fileExt = "gif") Then
                img.ContentType.MediaType = System.Net.Mime.MediaTypeNames.Image.Gif
            ElseIf (fileExt = "png") Then
                img.ContentType.MediaType = "image/png"
            End If

            img.ContentId = attName
            img.ContentType.Name = attName
            linkedResources.Add(img)
有帮助吗?

解决方案

其他提示

LinkedResources already sets the ContentDisposition to inline.

In fact, LinkedResources appears to exist only for the purpose of adding hidden embedded images and other inline content to your AlternateView. There is no option to set a filename, since users will never see it.

Use Attachments when you want visible, user-accessible files attached to your email, with filenames.

Use LinkedResources when you want hidden resources such as embedded images in your email, which you then reference in HTML with cid:.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top