Okay let me explain that a little better. I have a mvc project with a html page and some images and have set up a smtp server to send an email. When i debug the webpage i get the localhost url. (Localhost:51180) The Email i try to send looks like this: (simplified version):
<html>
<body>
<img alt="img" src="https://www.google.com/images/srpr/logo11w.png" />*Working
<img alt='img' src='localhost:51180/Images/img.png'/> *not working
</body>
</html>
My problem is that the second pic doesn't work. (if i copy past the url in my web browser while the project is running i can see its the right path). Is it because the website is running local on my computer and the email cant get access to it? or something else? Thanks in Advance!
A couple things to try..
#1
Try changing the url to
http://localhost:51180/Images/img.png
. you should have the protocol in there (http
) but i'm not sure you can do this...#2
Use base 64 encoding of the image to embed it. e.g.:
Yes you won't be able to get an image from the local host as it is not always running. You will only be able to get URLS from the Web or if you have stored the image locally within your workspace.
Yes. It's a security measure to prevent web sites from accessing/executing anything on your local computer without your permission.