I am converting Visualforce pages to Lightning Web Components. One element is a button that has as a target mailto:

What I am seeing: the mail client is started, with the proper To: value. But cc and body are empty. Even when I have a very simple mailto value:


The only thing that is filled, is the To. Everything after the ? seems to be ignored. Under Classic it's working perfectly. Do I need to do something else?

Part of HTML:

<div class="slds-no-flex">
  <form action={replyToEmailLink}>
    <button type="submit" class="slds-button slds-button_neutral">

Part of JS:

get replyToEmailLink() {
    return 'mailto:nowhere@mozilla.org?cc=nobody@mozilla.org&subject=This%20is%20the%20subject';

In the console I get a warning:

Mixed Content: The page at 'https://XYZ.lightning.force.com/lightning/r/Opportunity/0060C0000039cbDQAQ/view' was loaded over a secure connection, but contains a form that targets an insecure endpoint 'mailto:nowhere@mozilla.org?cc=nobody@mozilla.org&subject=This%20is%20the%20subject'. This endpoint should be made available over a secure connection.

But the link itself is working, I get a mail-compose window of my email client (Outlook).


The form action tag only accepts a url if you need to provide a query parameter you need to specify it as input element of hidden type


<div class="slds-no-flex">
<form action={replyToEmailLink} method="GET">
  <input type="hidden" name="cc" value="nobody@mozilla.org" /> 
  <button type="submit" class="slds-button slds-button_neutral">
    Mail Me

An even better approach is to just use an <a> tag


<lightning-card title="Mail Example">
      <a href={replyToEmailLink}>Mail me</a>
  • Excellent, thanks! My link has to look like a buton, so I ended up with: <a class="slds-button slds-button_neutral" href={replyToEmailLink}>{replyToEmailLabel}</a> Mar 18 '20 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.