You can’t send an email directly with javascript.
You can, however, open the user’s mail client:
window.open('mailto:[email protected]');
There are also some parameters to pre-fill the subject and the body:
window.open('mailto:[email protected]?subject=subject&body=body');
Another solution would be to do an ajax call to your server, so that the server sends the email. Be careful not to allow anyone to send any email through your server.
Related Posts:
- How to send an email from JavaScript
- Is JavaScript supported in an email message?
- How to convert a string to an integer in JavaScript?
- How do I make the first letter of a string uppercase in JavaScript?
- window.location.href and window.open () methods in JavaScript
- Define a global variable in a JavaScript function
- Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input’
- Cross-Origin Read Blocking (CORB)
- How can I remove a specific item from an array?
- How to create an associative array in JavaScript literal notation
- Include another HTML file in a HTML file
- Cannot open local file – Chrome: Not allowed to load local resource
- How to read a local text file?
- Compare dates with javascript
- Javascript Uncaught SyntaxError: Unexpected identifier
- “document.getElementByClass is not a function”
- How can I create a two dimensional array in JavaScript?
- How can I refresh a page with jQuery?
- forEach is not a function error with JavaScript array
- Short circuit Array.forEach like calling break
- Bootstrap Dropdown menu is not working
- String.prototype.replaceAll() not working
- What does the className attribute mean in JSX?
- How do I check for null values in JavaScript?
- Pure JavaScript: a function like jQuery’s isNumeric()
- jquery SlideToggle effect in upward direction?
- Express Render not working return error: No default engine was specified and no extension was provided
- Remove Object from Array using JavaScript
- Angular4 – No value accessor for form control
- What is the difference between ( for… in ) and ( for… of ) statements?
- TypeError: Cannot read property “0” from undefined
- How to use npm jquery module?
- Jquery swipe left or right on mobile
- Node.js Error: connect ECONNREFUSED
- Sort array by firstname (alphabetically) in Javascript
- Sorting arrays in javascript by object key value
- How do I get an element to scroll into view, using jQuery?
- Uncaught SyntaxError: Unexpected token :
- How do I check if string contains substring? [duplicate]
- Basic Ajax send/receive with node.js
- How to fix Cannot find module ‘typescript’ in Angular 4?
- Origin null is not allowed by Access-Control-Allow-Origin
- using jQuery $(this).addClass not working, simple code not working
- onClick to get the ID of the clicked button
- HTML text input allow only numeric input
- How to change the buttons text using javascript
- Can you write nested functions in JavaScript?
- How to use jQuery in chrome extension?
- How to use in jQuery :not and hasClass() to get a specific element without a class
- Crop the image using JavaScript
- What is the best way to remove a table row with jQuery?
- Adjust width and height of iframe to fit with content in it
- document.getElementbyId() returning null
- Seeding the random number generator in Javascript
- Bootstrap popover is not working
- Sort array of objects by single key with date value
- How to add a tooltip to an svg graphic?
- How do I make a discord bot join a voice channel?
- Create a simple 10 second countdown
- Generate a Hash from string in Javascript
- jQuery if Element has an ID?
- Get name of object or class
- Complex JSON nesting of objects and arrays
- jQuery – Increase the value of a counter when a button is clicked
- Insert a string at a specific index
- Getting a random value from a JavaScript array
- Moment Js UTC to Local Time
- Get the size of the screen, current web page and browser window
- AngularJS POST Fails: Response for preflight has invalid HTTP status code 404
- Getting “Cannot call a class as a function” in my React Project
- Separating html and JavaScript in Flask [duplicate]
- How to read and write into file using JavaScript?
- How to use aria-expanded=”true” to change a css property
- Nonce retrieved from the REST API is invalid and different from nonce generated in wp_localize_script
- wp.customize.bind ready event not fired
- What does wp-list.js do?
- Preventing YouTube embeds loading multiple instances of player JS?
- How to combine javascript files without plugins?
- conditional layout based on if Innerblocks is not empty
- WordPress Errors? Update Failed! data.min.js
- Use useSelect/useDispatch instead of withSelect/withDispatch
- Load script after block is inserted
- Only loads on the contact template page
- Trouble adding JavaScript in visual editor (Sharpspring embed code)
- How to set translations in javascripts for my plugin?
- How can I use CKEditor with WordPress and let clients edit the content?
- esc_js() breaks unicode sequences by removing the slash ‘\’ character
- wp_enqueue_script not loading my custom js file
- Gutenberg getBlockIndex in save() function
- Widgets and Post/Page edit/new blank, console errors only, no server errors
- Why does a on Comment edit page submit the page?
- Custom JS text area in customizer is being formatted wrong in document
- TinyMCE Javascript URL Question
- how to prevent added meta box from being injected with style=”position: fixed; top: 56px;” at scroll down
- Add JavaScript-Library “Fitty” to WordPress
- How to use value from modal tinymce windowManager?
- early enqueueing javascript file in page template, not in functions.php
- Wysiwyg editor not working on 4.2.2
- jQuery + more won’t load in header
- JavaScript errors