How to show image in a HTML file (to send as EMail)

I've a HTML file in a folder. The HTML file contains some placeholder. I'll replace the placeholder with appropriate content. Then that will be sent as E-mail to user.

I've image in the HTML file. Src="MyFile.jpg".

NOTE: The html file and Image are in same folder in my project.

While sending Email the image is missing. How to resolve this issue?

Please do suggest
LVL 16
Easwaran ParamasivamAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
If you use an absolute URL ( instead of a relative link (myimage.jpg), they will be able to see the image.  They will probably have to Ok the download of the image but that's normal these days.
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi EaswaranP,

There are few options-
- You have to attach the image with the mail and give the relative path
- You can host the image somewhere on internet and give the path to it. (not advisable)
- You can embed the image with the mail (most recommended) Convert it to base64

Go through this-

Dale BurrellDirectorCommented:
I would use this free component

Not only does it handle the placeholders for you, it automatically embeds the images, and it sends better emails than the standard .net ones.
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Easwaran ParamasivamAuthor Commented:
Hi Rikin_shah.

  I like your third point. But how to achieve this in .NET in such a way that it should be opened correctly in any browser including outlook.

  Please do suggest.
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi EaswaranP,

If there are very few/static images to be embedded in your mail, you can go for the online base64 converter-

In case you need to embed images dynamically, then use this methods-

Easwaran ParamasivamAuthor Commented:
You have to attach the image with the mail and give the relative path

Please do provide sample for this option. If adding as attachment I am not sure how this could be showns as Embeded image.

I am using static image only.
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale BurrellDirectorCommented:
Or do it the easy way using the component I recommended... you'd have it done and working by now if you had :)
Easwaran ParamasivamAuthor Commented:
This saved my day. Thanks!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.