To send email from JavaScript provide us easiness to not configure own server for this task, let consider a small static website having a contact form, generally for this form developer have to set up some server for receiving email from that contact form. Now it is easy to receive that email through JavaScript easily. So follow the article to learn
Email sending configuration on mailjs
First of all, go to https://emailjs.com and create an account, if you have already an account then sign in.

Then select the type you want to use, for this example I will select Gmail

This asks for authentication and allow the Gmail account to send emails for this service.

After allowing this the account will be connected with emailjs.com then click on create service, the service will be created and now it will be possible to send email from JavaScript.
Now as my service is created, now I will create an email template for sending emails through JavaScript.

For creating a template go to the Email templates tab and click on create new, This will be the actual template for viewing an email that was received through JavaScript.

This will create a default template, if you want to make some changes you can.
In the Content tab, I put my email address which will be used as my email address for sending.

Then navigate to the Setting tab and give some name to the template and save it.
Integration with own code
After saving the template now it is time to send an email through JavaScript. Click on Playground to see the code.

Then copy HTML from there to put in HTML and JavaScript to put in your code.

There are methods available for different development environments. In

For plain JavaScript follow the browser tab and paste the script into your code.
Here is the preview of my implementation of code



You can download my code which you can see in the above design from github.com/bakarfreelancer/email-js
The emailjs.com provide 200 email fee per month. That is more than enough for startups and small businesses.
So that was all about sending emails from JavaScript. Enjoy!