views:

29

answers:

3

I open outlook from my Winfoms application. I want to open outlook in reply mode. How can I do this.

Thanks.

A: 

so you want to open outlook and have it ready to send an email to a prefered receiver.

the quick and dirty fix i think is to have a hidden webbrower in your program and let the browser navigate to mailto:[email protected]?subject=somekindsubject which will open the default email client on the machine.

Stefanvds
A: 
System.Diagnostics.Process.Start("mailto:[email protected]");

The mailto can be used with a lot of parameters

Check out the parameters here

http://www.ianr.unl.edu/internet/mailto.html

http://msdn.microsoft.com/en-us/library/aa767737(VS.85).aspx

http://www.ietf.org/rfc/rfc2368.txt

Eg (Taken from MSDN)

mailto:[email protected]?subject=MessageTitle&body=MessageContent

UPDATE: Attachments i think are not supported due to security reasons and I strongly agree with it as well.

However Outlook 2003 seems to be accepting the parameter "attachments" according to someone who has posted in MSDN.

string email = "mailto:[email protected]?attachments=\"\"C:\\file.txt\"\"";       

System.Diagnostics.Process.Start(email);

This is the best i could do and i cannot test it as I do not have Outlook 2003. But even if it works in Outlook 2003, i strongly urge you not to use the attachment parameter as it may not be supported by different programs.

Ranhiru Cooray
Mark
See the updated answer :)
Ranhiru Cooray
A: 

You can use something like:

System.Diagnostics.Process.Start("mailto:[email protected]?subject=Sample subject");

Which will open the default email application filling in the to and subject fields. You can find more options here.

Edit: this takes a bit of time on my system, so make sure that if your user has a slower computer they'll know what's going on. Also, you should handle the case when they don't have Outlook or another mail program installed if it's a possibility.

Rox