Solved

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

Posted on 2012-03-20
9
423 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 82

Expert Comment

by:Dave Baldwin
Comment Utility
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 19

Expert Comment

by:Rikin Shah
Comment Utility
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
Comment Utility
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
 
LVL 16

Author Comment

by:Easwaran Paramasivam
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 19

Expert Comment

by:Rikin Shah
Comment Utility
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
Comment Utility
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 19

Accepted Solution

by:
Rikin Shah earned 500 total points
Comment Utility
0
 
LVL 21

Expert Comment

by:Dale Burrell
Comment Utility
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
Comment Utility
This saved my day. Thanks!!!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now