Solved

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

Posted on 2012-03-20
9
424 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

24 Experts available now in Live!

Get 1:1 Help Now