如何使用 .NET Compact Framework 打开新电子邮件并分配主题
-
05-07-2019 - |
题
基本上,我试图完成与“mailto:bgates@microsoft.com”在 Internet Explorer Mobile 中所做的相同的事情。
但我希望能够通过托管的 Windows Mobile 应用程序来完成此操作。我不想在后台按语法发送电子邮件程序。
我希望能够在 Pocket Outlook 中创建电子邮件,然后让用户完成其余的工作。
希望这对你有帮助希望对我有帮助!
解决方案
我假设您使用C#。您添加对System.Diagnostics的引用,然后编写以下代码:
ProcessStartInfo psi =
new ProcessStartInfo("mailto:bla@bla.com?subject=MySubject", "");
Process.Start(psi);
这将启动移动设备上的默认电子邮件客户端。
mailto协议定义可能会出现也很方便。
其他提示
您还可以使用 Microsoft.WindowsMobile.PocketOutlook.MessagingApplication.DisplayComposeForm,如下所示:
OutlookSession sess = new OutlookSession();
EmailAccountCollection accounts = sess.EmailAccounts;
//Contains all accounts on the device
//I'll just choose the first one -- you might want to ask them
MessagingApplication.DisplayComposeForm(accounts[0],
"someone@somewhere.com", "The Subject", "The Body");
DisplayComposeForm 方法有很多重载,其中包含附件等选项。
不隶属于 StackOverflow