Solved

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

Posted on 2012-03-20
9
425 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 83

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 19

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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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 19

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 19

Accepted Solution

by:
Rikin Shah earned 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 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

12 Experts available now in Live!

Get 1:1 Help Now