I want to open the "new mail" view using the default mail client (i.e. open a new mail form in Outlook). But when I go
我想使用默认邮件客户端打开“新邮件”视图(即在Outlook中打开一个新邮件表单)。但是当我走的时候
String cmd = "explorer.exe \"mailto:a@b.com?subject="+
subject+"&body="+body+"\"";
Runtime.getRuntime().exec(cmd);
the mail shows up, but I have a problem: explorer.exe
brings up an Internet Explorer instance with a dummy page. Is there a better application to run, such as rundll.exe with certain arguments?
邮件显示,但我有一个问题:explorer.exe打开一个虚拟页面的Internet Explorer实例。有没有更好的应用程序运行,如rundll.exe与某些参数?
I know it is possible to do it without bringing up iexplore from C++, but I don't know how in Java.
我知道有可能在没有从C ++中提出iexplore的情况下这样做,但我不知道如何用Java。
2 个解决方案
#1
2
Try with java.awt.Desktop (java 6)
试试java.awt.Desktop(java 6)
Desktop dt = Desktop.getDesktop();
dt.mail();
will open the default mail client (the one associated with mailto: protocol).
将打开默认邮件客户端(与mailto:protocol关联的客户端)。
#2
1
I found the answer when googling for rundll.exe:
我在google搜索rundll.exe时找到了答案:
String subject = ...;
String body = ...;
String cmd = "rundll32.exe shell32.dll,ShellExec_RunDLL \"mailto:a@b.com?"+
"subject="+subject+"&body="+body+"\"";
Runtime.getRuntime().exec(cmd);
Sorry for wasting your time!
抱歉浪费你的时间!
#1
2
Try with java.awt.Desktop (java 6)
试试java.awt.Desktop(java 6)
Desktop dt = Desktop.getDesktop();
dt.mail();
will open the default mail client (the one associated with mailto: protocol).
将打开默认邮件客户端(与mailto:protocol关联的客户端)。
#2
1
I found the answer when googling for rundll.exe:
我在google搜索rundll.exe时找到了答案:
String subject = ...;
String body = ...;
String cmd = "rundll32.exe shell32.dll,ShellExec_RunDLL \"mailto:a@b.com?"+
"subject="+subject+"&body="+body+"\"";
Runtime.getRuntime().exec(cmd);
Sorry for wasting your time!
抱歉浪费你的时间!