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,
- How to get UTC (GMT) time using JavaScript
- Submit html form on dropdown menu value selection or change using javascript
- How to detect Browser and Operating System Name and Version using JavaScript
- JavaScript : Get current page address
- [javaScript] Convert text case to lowercase
- How to check if a String contains substring or a word using javaScript
- Writing your first Hello, World! 🌍 JavaScript code Tutorial
- JavaScript: Check if variable is a number
- How to send email from JavaScript HTML using mailto
- Meaning of javascript:void(0) explained with example
- How to get query string in JavaScript HTML location.search
- Javascript convert text case from uppercase to lowercase
- Loading previous page using html button using JavaScript
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- How to get current URL Location using Javascript HTML
- Detect if Cookies are enabled using JavaScript
- Write javaScript code in Swedish using FikaScript
- Add Animated Scrolling to Html Page Title Script
- JavaScript: Convert an Image into Base64 String
- Remove items from JavaScript array
- Send Extra Data with Ajax Get or Post Request
- How to Print from JavaScript HTML using window.print
- Get Device Screen Width and Height using javaScript
- Examples: Convert String to int in JavaScript
- npm WARN saveError ENOENT: no such file or directory, open /mnt/c/package.json
More Posts:
- Python Sleep Function/Method Code Example - Python
- Facebook, Messenger, and Instagram down in many regions - UK, Europe, Australia - Facebook
- Fix Microsoft Windows Update Error 80072EFE - Microsoft
- Get the Complete Sha256 Container ID for Docker Run Command - Docker
- macOS 13 Ventura - The New About this Mac Window - MacOS
- Compare Current and Previous Versions of Same File (Local History) in Eclipse - Eclipse
- fix macOS: The digital signature on the update is missing or invalid. Ventura - MacOS
- Save Screenshots on Mac in JPG instead of PNG Format - MacOS