Microsoft Word has "send as attachment" functionality which creates a new message in Outlook with the document attached. 
I would like to replace Outlook with a custom mail agent, but I do not know how to achieve this. Now my mail agent is simply a program that runs, and takes a file name as parameter. 
As far as I know, "send as attachment" is using some DLL/API called MAPI. I would need to change my app so that it does not simply accept file name arguments, but can receive MAPI(?) calls MS Word uses when "sending as attachment".
Further, I need to change the default mail agent by creating my own MAPI32.dll stub which simply redirects to my app.
I'd appreciate if anyone had more info on how this could be achieved!
OK, to answer my own question. I need to build a DLL with "MAPISendDocuments" and/or "MAPISendMail" functions defined.
This DLL can have any name, and is referenced in the registry at HKLM/Software/Clients/Mail/MyMailApp/DLLPath.
Found examples using Delphi...
How to create a MAPI32.dll stub to be able to "send as attachment" from MS Word?