SendTo mail recipient (part II)

Download executable and source code - 20 Kb


In part I, I discussed how to programmatically simulate the Send to mail recipient shortcut found in the Windows Explorer shortcuts, as a way to send file attachments by email using the default client email. This code requires the user intervention to actually send the email. In this part, I'll give a command-line mode to achieve the same.

The command-line has a strong advantage over a library, it's that it can be integrated in pretty much any environment. That's probably the reason someone asked for a command-line version of this thing.

So here we go with the command-line switches :


Now for an example :

sendto.exe -files c:\mylog.txt "c:\my documents\summary.xls" -subject "please find the log file and an update to the summary" -to

As you can see, you have to use double quotes around filepaths or content including spaces.



Details and updates

The implementation uses the MAPI dll to do that. Since MAPI32.dll is part of the Windows OS regardless the version, you shouldn't have any problem using it.

The executable does not as of date directly supports wildcards or entire folder content sending. If you want this built in the executable, then you are better off implementing it yourself. Of course, you can send back the resulting code so I can integrate it.


Stéphane Rodriguez - August 10, 2004.