views:

184

answers:

1

I'm using System.Net.Mail to send HTML e-mail with attachments.

I'd like to add a custom header to the attachments, like so:

--multipart_related_boundary  
Content-Type: image/png  
MIME-Version: 1.0  
Content-Transfer-Encoding: base64  
Content-Location: http://example.com/images/logo.png

See that last header, Content-Location? That's the one I can't figure out how to set. The rest are properties of the System.Net.Mail.Attachment class, but does anybody know how I can add a Content-Location header?

The reason I'm doing this is that I'd like to include images in my messages, and I'd also like to embed those images in the message itself so that e-mail clients will show them by default without requiring the user to click "show images". This blog post mentions the Content-Location header as the best way of doing this (it's in the comments), and I'd like to try it out, since all the other methods I've tried have various deal-breaking drawbacks.

+1  A: 

Perhaps the System.Net.Mail.LinkedResource class is what you are looking for. It has a ContentLink property for specifying a URL.

Remy Lebeau - TeamB