I have an application which displays a list of users , When clicking on the email button I want the email client to open up with a prepopulated message ( I make the message using javascript) , I am not sure about how to prepopulate the message
Any help would be appreciated
I would post snippets , but honestly I dnt know how to start with this
URI encode the text and then append it to a mailto: URL:
<a href='mailto:[email protected]?body=text%20here'>Send mail!</a>
More generally, you can use:
body parameters will put each on a new line)with an ampersand (&) between each pair.
mailto:[email protected]?subject=Hi&body=some%20text
You can use jQuery to find all the links that have mailto:, then process their href to add the message body:
$("a[href^='mailto:']").prop( "href", function(i, prop){
return prop + "?body=" + encodeURIComponent( "Your message here" );
});
Demo:
http://jsfiddle.net/6qXrU/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With