html - Javascript function for email sending is not working (fixed command opens outlook while function doesn't) -


I am creating a website and I have to send a form text as an email. I'm running the script before the body, because the function is not working, blocking the whole script is the function I use:

  function email () {var Command = 'mailto: blahblah@gmail.com? Subject = '; Command = + document.getElementById ('subject'). Values; Command = + "and body ="; Command = + document.getElementById ('context'). Values; window.location.href = command; }   

So basically the user enters the message of the subject and the email in two areas and I want to send it as an email but it does not open the approach as it does I use a certain command.

My HTML code used is:

  & lt; Button onclick = "email ();" & Gt; & Lt; / Button & gt;   

I corrected all the things mentioned in the comments and now I get an error:

The file can not be found on / c: / ... / NaN Check file name for capitalization or other typing errors Check to see if the file was moved, renamed or deleted.

In order to send an email to the user using his mail client, you do not have to email directly to your app from javascript Can send You have to send the contents of the form to your server, and then email it from there. There are plenty of server-side libraries to send email (I use nodemaller) or you can use a service to send mail to you, like Mailchip or Sendgid

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -