Click to See Complete Forum and Search --> : ASP.Net/C# - Trap the button click event from html content


sb_rkarnati
February 4th, 2008, 08:17 AM
Hi,

We have a C# windows appilcation that sends out emails to our customers. We want to put some buttons in the content of the mail and when the users click on the buttons, we want to send a reply to some address. We are facing the following problem in this task:
1. In the emails that the customers receive, we are not able to trap the button click event. How to do this? We want to write the code in the button click to send mails to an address. How do we capture the button click event in the mail content?

Thanks in advance
RS

Yeorwned
February 4th, 2008, 11:27 AM
There is really no way to be able to send an e-mail that contains asp.net code run at the server. The only way possible would be to send an iframe but that's ugly and may not be supported by various clients/e-mail servers. You should avoid any scripting in e-mail at all costs.

If you want to make something happen, provide a link in the e-mail that when the user clicks on the hyperlink, your server processes the request and performs the action server side. If it is a static address, you can even use the standard mail uri(mailto:myname@mydomain.com?subject=hello (myname@mydomain.com?subject=hello)) as the hyperlink address.