Sending HTML Email with images in C# 2.0

  • Thread starter Aneesh Pulukkul[MCSD.Net]
  • Start date
A

Aneesh Pulukkul[MCSD.Net]

Hi,

I have a HTML page and associated images. I need to send the HTML as
email -the email should also display the images at respective places.
So am sending the content of HTML file as MailMessage.Body and adding
all the referred images using MailMessage.Attachments.Add().

The images referred using <IMG SRC="Logo.png" /> are displaying
properly in the email, but the image referred by <TABLE
STYLE="background-color:#000000;background-image:url(Background.png);
width: 600px; height: 800px;"> is not displaying in the mail and it
stays in the attachment section. Due to requirements I cannot modify/
replace background-image:url(Background.png); section in the STYLE
property.

Is there any way to embed the images inline in this context? Or is
there any way to render the the aforementioned Background.png image
from attachments?

Any inputs will be appreciated!

Thanks in advance.

Regards,

Aneesh P
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Aneesh Pulukkul said:
Hi,

I have a HTML page and associated images. I need to send the HTML as
email -the email should also display the images at respective places.
So am sending the content of HTML file as MailMessage.Body and adding
all the referred images using MailMessage.Attachments.Add().

The images referred using <IMG SRC="Logo.png" /> are displaying
properly in the email, but the image referred by <TABLE
STYLE="background-color:#000000;background-image:url(Background.png);
width: 600px; height: 800px;"> is not displaying in the mail and it
stays in the attachment section. Due to requirements I cannot modify/
replace background-image:url(Background.png); section in the STYLE
property.

Is there any way to embed the images inline in this context? Or is
there any way to render the the aforementioned Background.png image
from attachments?

I think that it will depend of the way that the user read the email, did you
try a webmail system like hotmail, yahoo, gmail?
 
A

Aneesh Pulukkul[MCSD.Net]

Hi,











I think that it will depend of the way that the user read the email, did you
try a webmail system like hotmail, yahoo, gmail?- Hide quoted text -

- Show quoted text -

I was talking about the appearence of email in Outlook. As you ponied
I tried sending it to yahoo mail, here none of the images are coming
as expected. Images will appear as attachments only. Got to see one
AlternateView class, using which we can have images as
LinkedResources. Will try this out. Any thoughts?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top