Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2012-03-20
9
Medium Priority
?
437 Views
Last Modified: 2012-03-21
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
0
Comment
Question by:Easwaran Paramasivam
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 37745893
If you use an absolute URL (http://www.mysite.com/myimage.jpg) 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.
0
 
LVL 20

Expert Comment

by:Rikin Shah
ID: 37745894
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-
http://danielmclaren.com/node/90

Regards,
Rikin.
0
 
LVL 21

Expert Comment

by:Dale Burrell
ID: 37745901
I would use this free component http://www.codeproject.com/Articles/19546/MailMergeLib-A-NET-Mail-Client-Library

Not only does it handle the placeholders for you, it automatically embeds the images, and it sends better emails than the standard .net ones.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 37745942
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.
0
 
LVL 20

Expert Comment

by:Rikin Shah
ID: 37745969
Hi EaswaranP,

If there are very few/static images to be embedded in your mail, you can go for the online base64 converter-
http://www.motobit.com/util/base64-decoder-encoder.asp

In case you need to embed images dynamically, then use this methods-
http://www.dailycoding.com/Posts/convert_image_to_base64_string_and_base64_string_to_image.aspx

Regards,
Rikin.
0
 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 37745989
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.
0
 
LVL 20

Accepted Solution

by:
Rikin Shah earned 2000 total points
ID: 37746079
0
 
LVL 21

Expert Comment

by:Dale Burrell
ID: 37746169
Or do it the easy way using the component I recommended... you'd have it done and working by now if you had :)
0
 
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 37746578
This saved my day. Thanks!!!
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question