Fri Day February 2016

How to send an email in javascript?

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.

Answers


Lajos Arpad February 2016

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.

Post Status

Asked in February 2016
Viewed 2,352 times
Voted 5
Answered 1 times

Search




Leave an answer