WebDevelopersNotes logo

home-icon Home / Answers / JavaScript email

JavaScript email

JavaScript email

I have started to learn JavaScript about a week back so I’m just a beginner. A pressing objective is to create a form on a website through which visitors can send an email. How can I use JavaScript to send an email from a website?
Stan

JavaScript is primarily a client-side language, which means it runs on the web browser program. However, to email visitor feedback from a web site form you need to take the help of a script that’s executed on the server.

Thus, there is no way client-side JavaScript can be used on its own to send email via a form on a web site! Technically, email is sent from the server and not from a client.

Sponsored Links

Confused? Read more about the differences between clients and servers.

Can you use JavaScript to send email from a web site?

Use a server side language and not JavaScript for email

To email visitor inputs from an online form, one typically employs a server-side script written in Perl, PHP, ASP etc. Which programming language you use depends on the web server platform (operating system). FYI, PHP script can be developed and made to run on all popular operating systems including Windows, Mac and of course, Linux.

And now for some good news. You don’t need to write an emailing script because plenty of these are available on the web for free – refer that link for details. First determine the web server platform and the best way to do this is to get in touch with the service provider. Also ask them about the various server-side scripting languages installed; yes, there can be many.

Once you obtain all the information choose a programming language and then download and configure a emailing script on your site… it’s going to be a good learning experience.

By the way, many hosting companies provide an easy-to-setup emailing script via the control panel. You can also look into that option.

Which language to I recommend?

I’m from the old school so would suggest using Perl or PHP. The advantage of using either of these is that you can get tons of free scripts that can email visitor feedback from your web site. You can also find lots of help on the web in case you get stuck. PHP and Perl scripts can also be made to run on different operating systems with minimal changes.

Note for budding web developers: You can use JavaScript to configure an HTML mailto. So, JavaScript can help a bit with email set up on a web site.

Finally, whichever language you use, remember you can also integrate JavaScript in your email script for client-side verification.

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

The first animals sent into space were fruit flies aboard the US V-2 rocket on 20 February 1947. The flies returned alive. [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy