How to fire mailto urls from action method

Suraj picture Suraj · Jul 3, 2013 · Viewed 13.1k times · Source

I am a beginner in MVC. I want to develop an action method in MVC which fires Mailto:?body=body goes here.&subject=test subject and so the default mail client will automatically populate the email for the user. Right now I have List<String> which contain mailto: urls.

Please, if you have any experience or demo code it will be helpful to me. Thanks in advance.

Answer

Bastien D picture Bastien D · Jul 3, 2013

try this :

window.location.href = "mailto:[email protected]";

with body

window.location.href = "mailto:[email protected]?body=yourBody";

Event with jquery

$('button').on('click', function(){
    window.location.href = "mailto:[email protected]?body=yourBody";
});