How to simulate a “mailto:” call on Winforms Button Click?

后端 未结 2 1100
旧巷少年郎
旧巷少年郎 2021-02-12 12:46

I will send an email with a given address by open the standard email program like \"mailto:\" in an a-tag will do it, but within a button click.

How?

相关标签:
2条回答
  • 2021-02-12 13:29

    Example from here

    private void btnEmail_Click(object sender, EventArgs e)  
    { 
       string command = "mailto:info[at]codegain.com?subject=The Subject&bcc=vrrave[at]codegaim.com";  
       Process.Start(command); 
    }
    
    0 讨论(0)
  • 2021-02-12 13:31

    Here's how:

    Process.Start("mailto:foo@bar.com");
    

    Additionally, you can PInvoke into ShellExecute to gain more control over this.

    0 讨论(0)
提交回复
热议问题