Configure a button to send Email by a text field

Hello,
I can’t figure out why the email is not going.
The send button contains the email address that is defined by a customer search.

import wixLocation from 'wix-location'

$w('#buttonEnvoie').target = $w('#textMailCandidat').text;

export function buttonEnvoie_click(event) {
    let body_message = $w('#text77').text;
    let email = $w('#textMailCandidat').text;
    let subject = 'Compte rendu';
    let mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + body_message;
    wixLocation.to(mailto_link);
    console.log(mailto_link)
} 

You cannot use mailto links with Velo buttons.
If your website is connected to your own domain, you can add a custom element to your page and make it collapsed and use it):

//page code
$w.onReady(() => {
$w('buttonEnvoie').onClick(() => {
 const info = {
  subject: 'Compte rendu',
  body: $w('#text77').text,
  emailAddress: $w('#textMailCandidat').text,
  timestamp: Date.now()
};
//I added the timestamp, so every click will trigger the element with a different the value, even if it's the same email, subject and body.
 $w('#customElement').setAttribute('email-details', JSON.stringify(info));
 });
})
//custom element file
class EmailTo extends HTMLElement {
 static get observedAttributes() { return ['email-details']; }
attributeChangedCallback(name, _ ,newValue) {
if (name === 'email-details') {
 const info = JSON.parse(newValue);
 window.open(`mailto:${emailAddress}?subject=${encodeURI(info.subject)}&body=${encodeURI(info.body)}`, '_self');
        }
    }
}
customElements.define('email-openner', EmailTo);//use 'email-openner' when you define the custom element on the eidtor UI. 

Thank you very much for your help and your explanations, I couldn’t take it anymore :slight_smile: