简体   繁体   中英

Using C# or jQuery to cause Outlook window to open with a templated body…

Is it possible, and if so how, to use C# or jQuery in an MVC web application to have a button or a link on a page cause Outlook to open up with a set body and subject?

Basically, I want the user to be able to choose a template from a dropdownlist and then click a button or link saying 'Send Templated Email' and have the button/link open up the client's Outlook or default email application with the subject and body populated by the template that they chose.

How could I do that?

You can do this:

<a href="mailto:email@emu.edu?subject=Subject&body=Body Text">

...

// something like this
$('#btn').click(function () {
    $('#link').attr('href', 'mailto:' + $('#email').text() + '?body=' + template[idx].body + '&subject=' + template[idx].subject); 
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM