【问题标题】:How to simulate a "mailto:" call on Winforms Button Click?如何模拟 Winforms 按钮单击上的“mailto:”调用?
【发布时间】:2011-01-15 15:30:06
【问题描述】:

我将通过打开标准电子邮件程序(如 a-tag 中的“mailto:”)发送带有给定地址的电子邮件,但只需单击按钮即可。

怎么做?

【问题讨论】:

    标签: winforms email button


    【解决方案1】:

    来自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); 
    }
    

    【讨论】:

    【解决方案2】:

    方法如下:

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

    此外,您可以 PInvoke 到 ShellExecute 以获得更多控制权。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-01
      • 1970-01-01
      • 2020-06-06
      • 1970-01-01
      • 1970-01-01
      • 2019-01-10
      • 1970-01-01
      • 2022-01-21
      相关资源
      最近更新 更多