0

I am trying to create a button that will open an email in the User's default email app. Know I can use mailto on the client side but this will not work for me because I need to pull information from the server to put in the email. This is what I have so far:

<input type="button" value="Forward Ticket" onclick="location.href='@Url.Action("Forward", "Ticket", new { ticketNumber = Model.TicketNumber, target = "_blank" })'" />



[HttpGet]
    public ActionResult ForwardTicket(int ticketNumber)
    {

    }

I also know that I can send it completely from the server side - which I do in a lot of other cases. However, that will not work either because the user can forward it to as many people as they want and type in their own note.

As per CodeCasters I have converted to doing a mailto in a button:

<input type="button" value="Forward Ticket" /><a href="mailto:?subject=look at this ticket&body=You can view and respond to this ticket at https://helpdesk.stcusa.com/ChooseEditView?TicketNumber=@Model.TicketNumber"></a>

However, when I click it nothing happens.

djblois
  • 963
  • 1
  • 17
  • 52
  • No, you can't, other than through a `mailto:` link. It would be horrible if web pages would be able to open arbitrary applications (and they used to). See [Can I set subject/content of email with using mailto:?](http://stackoverflow.com/questions/4782068/can-i-set-subject-content-of-email-with-using-mailto) for how to set the subject and body in a `mailto:` link. – CodeCaster Dec 16 '15 at 15:46
  • @CodeCaster ty so I will not be able to do what I fully wanted to do. So I can get partially what I wanted with mailto but I updated the OP with the issue I am having with it. – djblois Dec 16 '15 at 16:04
  • You'll have to click the anchor. The button as you specified it doesn't do anything. Your anchor has no content, so it is not displayed. – CodeCaster Dec 16 '15 at 16:24
  • @CodeCaster, I tried adding the href to the onclick reference of the button- is that possible? – djblois Dec 16 '15 at 16:45
  • Try searching, maybe. :) – CodeCaster Dec 16 '15 at 16:52

0 Answers0