tags:

views:

62

answers:

2

How can I programatically open a new message window in the default email client (such as Outlook) using Windows API calls? I will need to include an attachment and would prefer to specify the default message body in 'rich text' (ie. not plain) format.

+1  A: 

I think you can do this using the ShellExecute. An attachment should be used as parameter: something like this but I don't remember for sure: "mailto:emial@something?subject=subject?body=body?attachment=..."

sinec
Thomas
yes, you're right.
sinec
Beaner
+1  A: 

The ShellExecute solution is good for simple messages without attachments, but if you want more control over the process, you may try the MAPI; in particular, see the MAPISendMail function and the MapiMessage structure.

For even more complex needs, there's the extended MAPI, but I didn't find any documentation about it on the MSDN. However this seems to be a good wrapper around the extended MAPI.

Matteo Italia