I want to click on a button, take a text for the subject and a text for the body of the email. It easily takes the text for the subject, but not the body text. Any ideas?
I tested the link with PC and Windows Mail and iPhone with Apple Mail, both have the same problem, the body text is missing.
// Import the wixLocation API
import wixLocation from 'wix-location';
// Code in the ready() event handler
$w.onReady(function () {
// Add a click event handler to the button
$w('#button3').onClick(() => {
// Get the text from the text input field
let text = $w('#input2').value;
// Get the subject from the input field
let subject = $w('#input1').value;
// Create the mailto link with subject and text
let mailtoLink = 'mailto:?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(text);
// Debug output to check the mailto link
console.log(mailtoLink);
// Open the mailto link
wixLocation.to(mailtoLink);
});
});
Any experience importing text into the email body?