[英]unable to open the default mail client
I am using following code to open the default mail client 我正在使用以下代码打开默认邮件客户端
using (Process mailProcess = new Process())
{
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.FileName = string.Format(CultureInfo.InvariantCulture,
"mailto:{0}?subject={1}&body={2}",
sendToAddress.Address, subject, message);
processInfo.UseShellExecute = true;
processInfo.WindowStyle = ProcessWindowStyle.Normal;
mailProcess.StartInfo = processInfo;
Process.Start(processInfo);
}
It starts the process but doesn't show mail client. 它启动该过程,但不显示邮件客户端。 Actually when I am using only localhost it doesn't open the mail client although it starts the process.
实际上,当我仅使用localhost时,尽管启动了进程,但它没有打开邮件客户端。
When I am using localhost: it works. 当我使用本地主机时:有效。
Can anybosy hel me? 有人可以帮我吗?
This will start default email client 这将启动默认的电子邮件客户端
var process = @"mailto:some.guy@someplace.com?subject=an email&body=see attachment";
System.Diagnostics.Process.Start(process);
You can do it like this: 您可以这样做:
var url = string.Format(CultureInfo.InvariantCulture,
"mailto:{0}?subject={1}&body={2}",
sendToAddress.Address, subject, message);
Process.Start(url);
You have to use System.Diagnostics;
您必须使用
System.Diagnostics;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.