简体   繁体   English

使用c#打开带附件的默认邮件客户端窗口,

[英]open default mail client window with attachment using c#,

I googling and have tried below ways to achieve this, 我在谷歌上搜索并尝试了以下方法来实现这一目标,

 1, mailto:
 2, Registrykeys  - @"HKEY_CLASSES_ROOT\mailto\shell\open\command", "", "none");
 3, proc.StartInfo.FileName = string.Format("\"{0}\"", Process.GetProcessesByName("OUTLOOK")[0].Modules[0].FileName);

But this always returns outlook window only. 但这总是只返回outlook窗口。 But I want to open default mail client window which is from our device like Google chrome, MAIL Live window,OUTLOOK 但我想打开默认的邮件客户端窗口,它来自我们的设备,如Google Chrome,MAIL Live窗口,OUTLOOK

Attached Images for your reference. 附图供您参考。

在此输入图像描述

Please share your answers, 请分享你的答案,

A mail client may or may not provide an API to send a mail with attachment but there is no standard way to open the default (or any) mail client with attachment. 邮件客户端可能会也可能不会提供API来发送带附件的邮件,但没有标准方法可以打开带附件的默认(或任何)邮件客户端。

That being said you can open the default mail client with a mailto uri : 也就是说,您可以使用mailto uri打开默认邮件客户端:

    Uri myUri = new Uri("mailto:someone@example.com?Subject=Hello%20again&body=TEST");
    System.Diagnostics.Process.Start(myUri.AbsoluteUri);

You may try with other methods like MAPI or sending the mail yourself (SMTP) : C# MailTo with Attachment? 您可以尝试使用其他方法,如MAPI或自己发送邮件(SMTP): C#MailTo with Attachment?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM