Create Mailto link to pull in body into email

Hi I have successfully created a mailto link that opens the email Client with the correct email and subject but for reasons I cannot figure out it refuses to pull in the body content… Can anyone help? Does wix somehow block the body content?

import wixLocation from ‘wix-location’;

$w.onReady(function () {
$w(‘#text3’).onClick(function () {
wixLocation.to(“mailto:?subject=stay at home!&body=hello”)
})
})

1 Like

Following! Copied your code and put on my site (I’m in the processing of adding and coding a bunch of different share links myself) and I have the same problem. Have tried every combo I can think of, but it either inserts the body message into the subject line or the body message just doesn’t appear at all…

I will keep trying and let you know what I discover! Keep me posted if you find a solution!

Will do I hope one of us figures it out soon.

Hi,
Currently, the only option is adding the Email address and the subject as you can see in the documentation here . Other parameters within the “mailto” are not supported. In order to add those parameters, you can use an iFrame.

Best,
Tal.

OK I came to the same conclusion and embedded the mailto in an Iframe. Do you know if there is a way to do it with Javascript so that an html coded email can be sent in the body, through the default email client.

Hey,
After checking Stackoverflow , it seems like it’s impossible.

Best,
Tal.

OK thanks for all your help Tal!

Yes, I came to the same conclusion last night, but wasn’t certain. Thank you Tal for confirming! I also successfully managed to create an email share button using an html iframe borrowing from www.simplesharebuttons.com… However… I want to change the image to either one of the images in my media folder or from the free wix photo folder… How do I find the correct image url to change the image?

" Email

Hi Ashley you can host your image at https://imgbb.com/ and change your src link accordingly.

following…

UPDATE: I successfully created a share to email link using an iframe. But now, it’s come to my attention - it works on desktop, but not on mobile. The strange thing is, when I go to mobile view in the editor’s preview, the share to email link works! But when I go to the live mobile site, it doesn’t, it merely registers as an image with the option to “copy.” Any thoughts?

HTML Iframe code:

<a href="mailto:?Subject=This%20is%20a%20Story&amp;Body=I%20found%20the%20site%20www.wix.com">
        <img src="https://static.wixstatic.com/media/e7f4d5_593ab50f0ca54ba68c36ebed5c4327d5~mv2.png/v1/fill/w_64,h_64,al_c/e7f4d5_593ab50f0ca54ba68c36ebed5c4327d5~mv2.png" alt="Email" />
    </a>

(Also, ultimately, I want to share a dynamic page link to email, if anyone has an update or helpful suggestions on that subject - that would be wonderful!)

Hi, I need to gather variable values and embed them in the email. Tried mailto: in iFrame and got error like "cannot connect to mail.google.com". Configuration: win7, Chrome, default client gmail. Suggestions?

body { background-color: #3d9be9; } #theForm, body { padding: 0px; border: 0px; margin: 0px; } #theForm { margin-left: auto; margin-right: auto; } #theForm tbody td:nth-child(1) { text-align: right; padding-right: 1em; } .missing { background-color: Red; } .noShow { display: none; }

Email Subject
From:     Your Prefix/Name
Address Line 1
Address Line 2
City, State Zip AL AK AZ AR CA CO CT DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY
Email Body Dear Sir,

Please make a public statement in support of this vital executive action before the end of 2019.

Thank you.


As you know Wix works with Javascript and will only provide support for html code that it has provided by itself and knows that it works fully within Wix.
https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site

If you want to work with the html side, then you will need to find yourself somebody who works with html and can sort this question out for you.

If you want to use Wix alternatives, then look at using Triggered emails for a start.
https://support.wix.com/en/article/about-triggered-emails
https://support.wix.com/en/article/creating-a-triggered-email
https://support.wix.com/en/article/corvid-tutorial-sending-a-triggered-email-to-members
https://support.wix.com/en/article/corvid-tutorial-sending-a-triggered-email-to-contacts

Also, you can send emails on form submission too.
https://support.wix.com/en/article/corvid-tutorial-sending-an-email-on-form-submission
https://www.wix.com/corvid/forum/wix-tips-and-updates/example-send-email-with-the-sendgrid-rest-interface
https://www.wix.com/corvid/forum/wix-tips-and-updates/example-send-email-with-the-sendgrid-npm-interface

@givemeawhisky thanks will check out your leads
HB

Is this still the case? It seems very strange to support the subject parameters but not the body. Was this on purpose or just an oversight? Are there plans to support other parameters because this is very lacking.

Nope, read the Wix Location to in the Wix API Reference and it will state what you can do. https://www.wix.com/corvid/reference/wix-location.html#to
mailto:@<someplace.com>?subject=: An email.
The Mail To and the Subject are the only pieces of information supported.

Open a new email window

import wixLocation from 'wix-location';

// rest of code ...//

wixLocation.to("mailto:a@b.com?subject=Something%20Interesting");