[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

System.Web.Mail.MailMessage and Mutipart/Related Header problems

Richard

1/17/2003 5:49:00 PM

Dear All,

I have created a program (Windows Forms not ASP) which uses the
System.Web.Mail.MailMessage class and the System.Web.Mail.MailAttachment to
create an HTML Email with the images used in the HTML attached to the
message.

All the correct formats are set for bodytype and content.

Problem is that unlike the Messages created by outlook where you do not see
the attachments (i.e. each attachment is encoded with names like
39876398@2376493287)
With my program the images are shown as attachments as well and on Outlook
Express they are shown after the html content as a list of images.

I have tried setting the "Content-Type" header to "Multipart/Related" but
with no change in result. Could anyone advise me on this one?

Thanks very much in advance

Regards

Richard




1 Answer

Ryan Trudelle-Schwarz

1/17/2003 8:05:00 PM

0

"Richard" <rpg@breckland-ltd.com> wrote
>
> I have created a program (Windows Forms not ASP) which uses the
> System.Web.Mail.MailMessage class and the System.Web.Mail.MailAttachment
to
> create an HTML Email with the images used in the HTML attached to the
> message.
>
> All the correct formats are set for bodytype and content.
>
> Problem is that unlike the Messages created by outlook where you do not
see
> the attachments (i.e. each attachment is encoded with names like
> 39876398@2376493287)
> With my program the images are shown as attachments as well and on Outlook
> Express they are shown after the html content as a list of images.
>
> I have tried setting the "Content-Type" header to "Multipart/Related" but
> with no change in result. Could anyone advise me on this one?

AFAIK it is not possible using the MailMessage included in the FX. You can
interop to use CDO or you can use a third party program like aspNetEmail.

As for why it doesn't work though, IIRC it comes down to how the images are
included and how they are referenced in the html. Basically the image has to
be attached with a content-disposition of "inline" and a content-id that
matches the src="" attributes of the images (generally, this is not a file
name, but some form of unique identifier). Most 3rd party controls should do
all this for you but if you want to do it yourself (not sure if cdo would do
it for you) you can look at the RFCs about MIME.

hth, Ryan