Here is a simple example to send an email using JavaScript - mailto. You can use this code with any control (example - button) and even any event (example - onclick).
This code will invoke the user's default email client with the required parameters pre-filled (like email address, subject, message body) and user just needs to click send in order to send the email.
Note - It is not possible to directly send email from JavaScript, you can only invoke/open the default email client.
Code Type: Specify only Email IDwindow.open('mailto:useremail@domain.com');
Code Type : Specify multiple Email ID (separate id's by comma(,) or semi-colon(;) )
window.open('mailto:useremail1@domain.com,useremail2@domain.com');
Code Type: Specify Email ID, Subject, Body
window.open('mailto:useremail@domain.com?subject=This is the email subject&body=This is the email body');
More Posts related to JavaScript,
- Get Current time in GMT/UTC using JavaScript
- How to get current URL Location using Javascript HTML
- Excel Fix: SECURITY RISK Microsoft has blocked macros from running because the source of this file is untrusted.
- Convert Javascript object to JSON String example
- Fix: ReferenceError: require is not defined in ES module scope [Node]
- [JavaScript] Remove all Newlines From String
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- Fix: Error: error:0308010C:digital envelope routines::unsupported NodeJs/Vue/React
- Pure JavaScript Digital Clock Widget to get GMT/UTC Time Now
- Fix: npm vs code eacces permission denied unlink /usr/local/bin/code
- Power of Print Statements in JavaScript: A Comprehensive Guide
- [javaScript] Convert text case to lowercase
- JavaScript: Count Words in a String
- JavaScript date in yyyy-MM-dd format
- How to send email from JavaScript HTML using mailto
- How to get UTC (GMT) time using JavaScript
- JavaScript: Generate Random Numbers between 1 and 3
- How to get query string in JavaScript HTML location.search
- Fix: Uncaught ReferenceError: exit is not defined - Node.js REPL
- Detect if Cookies are enabled using JavaScript
- Submit html form on dropdown menu value selection or change using javascript
- Send Extra Data with Ajax Get or Post Request
- Loading previous page using html button using JavaScript
- 10 ways to Convert String to a Number in JavaScript
- JavaScript: Check if variable is a number
More Posts:
- Java 8: Get First and Last Date of the Week for Given Date - Java
- [Solved] SharePoint System.IO.FileNotFoundException was unhandled - SharePoint
- Java: List of Data Structures available - Java
- Create a Gradle Java Project in VS Code - Gradle
- String Boot + Redis - SET and GET String Commands Examples - Java
- How to Change Text Size for Android ActionBar - Android
- How to Kill a port using bash terminal command? - Bash
- bash: netstat: command not found - Bash