c#使用Process.Start发送电子邮件

Rob*_* J. 1 c# email outlook

我想使用默认电子邮件应用程序发送没有附件的简单电子邮件.

我知道它可以使用Process.Start完成,但我无法让它工作.这是我到目前为止:

string mailto = string.Format("mailto:{0}?Subject={1}&Body={2}", "to@user.com", "Subject of message", "This is a body of a message");
System.Diagnostics.Process.Start(mailto);
Run Code Online (Sandbox Code Playgroud)

但它只是打开带有预写文本的Outlook消息.我想直接发送这个没有用户手动点击"发送"按钮.我错过了什么?

谢谢

小智 5

你需要这样做:

string mailto = string.Format("mailto:{0}?Subject={1}&Body={2}", "to@user.com", "Subject of message", "This is a body of a message");
mailto = Uri.EscapeUriString(mailto);
System.Diagnostics.Process.Start(mailto);
Run Code Online (Sandbox Code Playgroud)