View Full Version : Sending Image files in HTML with JavaScript

Nov 28th, 2002, 08:21 AM

I have created a web page which I need to send out to people as an e-mail attachment.

The page is in HTML and JavaScript and has two images on it(.gif files)

When I tested it and sent it out the files are not displayed even though I sent the image files with the Web page.

How can I send the Web page as an attachment and make the image files visible ?

Must I create a folder and send the folder with everything in it?

I know that the files must be in the same directory.

Any help on how to do this please.


Nov 28th, 2002, 08:43 AM
don't use absolute paths in your image src.
if the html page and images are in a same folder, the image src would look like:

<img src="image.jpg">

it's better to just zip the folder where your html and images files are, then attached the zip file in the mail

Nov 28th, 2002, 09:50 AM
thanks glen.

i didnt think of using winzip....only problem is not everyone has winzip!


Nov 28th, 2002, 11:59 AM
If they don't have it, they need to get it. ;)

If you're concerned put a download link to winzip in the message... FYI javascript is not reliable in an email since some clients will not let javascript code execute (for security reasons).

BTW, another solution for having the images show up in the message is to upload them to a server, and reference the images that way, i.e.:

<img src="http://www.yourserver.com/images/blah.jpg" width="42" height="42" alt="" />

Of course, all of this assumes that the person receiving the message is able to read HTML emails to begin with.


Nov 28th, 2002, 05:44 PM
I agree with whammy's last comment - keep the images on your server and reference them absolutely.

Scripting in HTML email is a total non-starter - virtually no point even trying, because no self-respecting firewall will let that through.

Nov 28th, 2002, 06:24 PM
thanks for your input.

its just a javascript script in IE container that will be sent to less than 20 people who all have small businesses.

its actually a christmas message but my boss might just go with the million other free ecards online but i suggested that i could do it for him.Only i dont know flash etc for animation.

thanks for all your help.

this is a great forum.

for a laugh go to: