1

I am making a simple website, but to save I am making it send some text to an email using javascript.
I want to make it send directly, but if there is no way to do that it would be fine if it sends by going to the email site.
My code so far looks like this:

    var a = function(){
var b = document.getElementById("email").value;
document.getElementById("textarea").value.mailto=b;
};

I want the code to send the value of the textarea.

Fri Day
  • 11
  • 4

1 Answers1

0

You should have a server somewhere which listens to email sending commands. Your Javascript should send an AJAX request to that server, passing the necessary data and triggering the email sending functionality. The server, in turn should send the email(s) and respond to the Javascript part to notify the client-side whether it was successful.

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
  • I am a basic programmer and I don't know how to so maybe if there were a server online for free, that would work. Is there – Fri Day Feb 08 '16 at 22:35
  • @FriDay, you can do it offline. You need to set up a web-server application on your computer and create a project. If you have a server running on your computer and you use a Javascript code to trigger a functionality, then nothing stops you from writing the functionality to send the emails as you please. Read this: http://www.w3schools.com/php/func_mail_mail.asp, also, you can set up an email address you will be able to use to send the email from to the target(s). – Lajos Arpad Feb 08 '16 at 23:09