How to send email by using javascript or jquery

I developed a web-form for a blog, and I need to send its values to an email.

How can I send an email by using jQuery or JavaScript alone?


Solution 1:

The short answer is that you can't do it using JavaScript alone. You'd need a server-side handler to connect with the SMTP server to actually send the mail. There are many simple mail scripts online, such as this one for PHP:

Simple PHP mail script

Using a script like that, you'd POST the contents of your web form to the script, using a function like this:

jQuery.post

And then the script would take those values, plus a username and password for the mail server, and connect to the server to send the mail.