Reputation: 21
i am trying to open outlook with attachment as follows:
Runtime.getRuntime().exec(
new String[] {"rundll32",
"url.dll,FileProtocolHandler",
"mailto:" + "&attachment=" + "c:\\test.txt"}
);
outlook opens, but it don't get the attachment, i don't know why ? please advise. also is it possible to give the attachment web url from my application ?
like: http://myapp.com/files/123 (this link triggers file download)
Upvotes: 0
Views: 315
Reputation: 66255
mailto protocol does not support attachments. You would need to use the Outlook Object Model to explicitly create an instance of the Outlook.Application object, call Application.CreateItem() and then add the attachment using MailItem.Attachments.Add. You can then display the message using MailItem.Display.
Upvotes: 1