I need to perform following tasks;
-
on click of link (could be link button,
<a>or Hyperlink) the default email program at client machine should open up. -
Javascript for the same has been written as below:
string adminemail= "xyz@abc.com"; //fetches admin email address; display in To Field
ScriptManager.RegisterStartupScript(this.updatePanel1, typeof (string), "defaultemail", "window.open('mailto:" + adminemail+ " ');", true);
But, using the link button is not correct option, as it triggers postback. Hence i thought of using the <a> tag, but i am not sure how to link that with the javascript.
How to execute the JS with the help of <a> tag? OR Suggest some possible solution for the same.
Please guide!
Thanks!!
Why not just use
mailto? For example<a href="mailto:xyz@abc.com">Send email to the admin</a>You can also include
cc,bcc,subjectandbodyfields in the query string to customize the email. See the IANR syntax reference.