View Full Version : Javascript Email Project

11-10-2012, 04:03 PM
I'm trying to implement a javascript program into an html environment. I'm having trouble trying to figure out how to write the program.

Essentially, I want to have a bunch of document icons on a page. There would be a checkbox next to each document. Check all the appropriate documents one wants to send to someone. Click "Generate Email" and an Outlook (or default mailer) email would be created with said documents attached.

Please note that this site will be maintained on an Intranet, and won't be public. Only employees will have access to it.


Any ideas where I can start?

(JPC Solutions)

Philip M
11-10-2012, 10:19 PM
This forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others, but try to help with fixing code that doesn't work. You may perhaps get someone to write this script for you, but you'll be far more likely to get help if you have made a substantial effort and written some code yourself. Then someone here will almost certainly help you correct/improve your work.

You seem to be contemplating using the long-obsolete mailto:. Modern browsers no longer accept mailto: as a form action - they simply open the email program (if any) and ignore the form. If you are going to use a form then use a server-side CGI formmail script as the action - there are several good free ones out there.

Be aware that mailto: does not provide any way to include an attachment.

It is your responsibility to die() if necessary….. - PHP Manual

11-10-2012, 11:09 PM
Any ideas where I can start?

I'm guessing you're not actually looking for someone to write the code for you, so here are a few tips on how you can go about starting your project.

1. Markup the html to display the image icons, checkboxes and button in a form.

2. Each document should have a unique id value, if the docs are retrieved from a database, which should be set to the value of the doc's checkbox.

3. If the doc's meta data is not stored in a database you can use the doc's file name as the checkbox value.

4. Give all the doc checkboxes the same name so that the selected id's or file names can be sent as an array of values to a server side script (PHP can send email attachments very easily) that will send out the email with attachments.

5. The server side script will loop through the array of doc values sent to it, append all the attachments to an email and then send it out. If you will be using php then all of the above can be done in 2-3 hours max from go to whoa for someone who knows html, css and php. You don't need javascript at all for your project unless you want to do some optional client side data validation.

6. All validation must be done server side using php or your preferred server side language.