简体   繁体   中英

Process.Start not working on live site

Im trying to open the email client after a user accepts a disclaimer in a popup box whenever they click email someone. It works on local but will not work on live.

public void btnEmail_click(object sender, EventArgs e)
{             
     Process.Start("mailto:blah@blah.com");
}

I realize now this will not work correctly obviously. Is there a way to do what im looking for with javascript?

You'll have to register the mailto Protocol handler for that to work off the box like that.

look at Register Windows program with the mailto protocol programmatically on how it can be accomplished thru code.

or

If you want to open Outlook and send out a mail to someone -

Outlook /c ipm.note /m blah@blah.com

Thru Code -

string app = "Outlook.exe";
string arguments = @"/c ipm.note /m blah@blah.com";

Process proc = new Process();
proc.StartInfo = new ProcessStartInfo(app, arguments);
proc.Start();

The problem is probabbly is that your client doesn't have default Mail Client setupped on machine.

Hope this helps.

在JavaScript中,只需设置location.href

<input type="button" value="Send E-mall" onclick="location.href='mailto:blah@blah.com';"> 

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