views:

103

answers:

1

hi guys, i'm trying to create a small web app wherein in one form, the user may type in certain parameters as part of the message, then after he hits a button, it will show an Outlook (depends on his default email client) email client popup with all the details he placed.. and then it will include an attachment.

the javascript code looks like this:

function submitReport()
{
  var remarks = document.getElementById('remarks').value;

  if(remarks != '')
    body += 'Remarks: '+remarks;

  var href = 'mailto:[email protected]?subject=[Bug Report]  '+menu_path+'&body='+body;

  href += '&attachment="C:\\debug.log"';

  var form = DomUtils.createForm();
  form.setAttribute('action', href);
  form.submit();
}

i tried alerting the "href" variable and it shows:

mailto:[email protected]?subject=[Bug Report]&body=message_bodyReport Type: MonthlyStart Date: 2010-05-01 00:00:00End Date: 2010-05-31 23:59:59&attachment="C:\debug.log"

and surely an outclient popsup with all the subject, recepient email address, body.. but no attachment. anybody encountered this before? :(

the outlook used here is 2007.. if i run the web app in IE, it actually says an error

"The command line argument is not valid. Verify the switch you are using."

any ideas?

A: 

There is no way for a web page to cause a browser to open the user's email client with a file pre-attached from the hard disk.

Use a form and process it server side, or provide simple instructions along the lines of:

<p>Send an email to <a href="mailto:[email protected]">[email protected]</a>
and attach your log file.</p>
David Dorward