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

标签 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);

但它只是打开带有预先编写文本的 Outlook 邮件。我想直接发送,而无需用户手动单击“发送”按钮。我错过了什么?

谢谢

最佳答案

你需要这样做:

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);

关于c# 使用 Process.Start 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26403861/

相关文章:

email - 具有电子邮件验证功能的 Firebase 模板

vba - 在 Outlook 2010 中转发电子邮件及其附件

vba - IMAP 文件夹上的 Outlook ItemAdd 事件仅在选择文件夹时触发

c# - 如何在 WPF 应用程序中实现不同的 View 状态

c# - 我想一直检查标签的内容?

c# - 仅当满足条件时才从 ConcurrentQueue 中出队

JavaMail getText() 方法在 HTML 电子邮件中始终返回 null

email - 退回特定电子邮件地址收到的邮件

c# - 如何将 DapperRow 转换为 Dictionary<string,string>

outlook - 如何使用ics文件取消日历事件?