I have a images in my local pc.

That is located in "D:\projects\abc\systemimages\123.jpg"

Now i upload image in my template from above location.So it should be shown in my thank u template but when i sent mail with thank you template to another person he/she can't see this images.

Bubbly shah

Recommended Answers

All 3 Replies

hi Bubbly shah,

Absolute path is not possible while displaying an image..

it should be present in your virtual directory aka project directory.

try something like this..

create a folder images in your project...

add your thank you image to that folder..

and on thank you page..

Image1.ImageUrl = "~/Images/Thankyou.png";

please remember absolute path will never work..

hope that helps.

No yet it's not working...
Sorry but plz try to understand my code.

If i understand correctly from your thread then you want to show image with template in your message body when you send to another person. Am i right ? If so then you can't directly attache image in message body. You need to use LinkedResource and AlternetView.

Let's take a look in below line of code..

string strMailContent = "text you want to show in message body";
LinkedResource lr = new LinkedResource(path);
lr.ContentId = "companylogo";
// done HTML formatting in the next line to display my logo
AlternateView av = AlternateView.CreateAlternateViewFromString("<html><body><img src=cid:companylogo/><br></body></html>" + strMailContent, null, MediaTypeNames.Text.Html);
av.LinkedResources.Add(lr);
mailMessage.AlternateViews.Add(av);

Try by this way and let us know if it's not working ..

No yet it's not working...
Sorry but plz try to understand my code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.