View Full Version : How to add Attachment to Mailto

11-10-2002, 09:40 AM
My mailto script works fine - but how can I add an attachment to the email?

11-10-2002, 12:57 PM
i'm assuming that when you say "Mailto script" what you mean, is a form that has it's action set to "mailto:someguy@someplace.com".

if that's the case, then see the following link for a nice little tutorial on how to do this: http://www.htmlgoodies.com/attachp2.html

if that's not what you're talking about, then you're going to have to provide some actual details.

hope that helps

ps: as with your other post, because i don't think that this is going to have anything to do with javascript, i'm moving it to the HTML & CSS forum

11-10-2002, 04:55 PM
Thanks for the link to HTML Goodies - they have some interesting bits - but I can't figure out the mailto.

This is the line of code that I want to send a file with -

document.writeln('<a href="mailto:?subject=Pictures from PhotoAlbum&cc= &body=This is the body text&attachment='+filetosend+'">Email</a><br>');

It works fine and creates the email - until I try and add the attachment.

This is also where I want to break up the body text with carriage returns.

Thanks in advance!

11-10-2002, 05:10 PM
ok, the only way i know of, to send a file, without using a server side script, is the way listed in the HTML Goodies page.

as far as getting line breaks into the body, i'll post the answer to that, in the other thread.

11-12-2002, 10:01 PM
Help - I can't get this to work - it brings up the email program (Outlook) and puts in the subject and body text - but no attachment!

document.writeln('<a href="mailto:?subject=Pictures from PhotoAlbum&cc= &body=This is the body text&attachment='+mFiletosend+'">Email</a><br>');

mFiletosend is the path and filename - it looks OK in the status bar and it is the same as I use to display the image on screen.

Does Outlook need more of an address to find it?

Any ideas?

11-12-2002, 10:51 PM
HTML Goodies:

"I was successful with text-based documents like HTML. Word files and images never did come through correctly. They seemed to attach and send just fine, but would be destroyed when they arrived in my e-mail box."

Sorry, but I've never seen this question answered. I'd just use a cgi/asp/php script without all the annoying prompts. Much quicker and efficient, too.

Try finding an OE forum at Microsoft or Tek-Tips. :D

11-12-2002, 11:35 PM
Also, trying to format the body of a message using "mailto" is problematic, because Outlook Express is buggy using "mailto" in more than one way.

The only way (as joh6nn said) to reliably do either one (attachment or formatting) is to use a server-side language.