CRM 4.0 can't attach sales literature to emails - something that seems to be "obvious" - what's the point of being able to store sales literature in the CRM system (as a "repository") without being able to email it to contacts?
[Note: you can - just download onto your hard disk, then attach to email - but hang on - that defeats the whole object!!!]
A plugin lets us run custom routines during various "events": in this case we're interested in Create and Update of the email entity (and post-event).
The steps we need are:
The easiest way to show this is to simply post the C# code used - no warranties or guarantees; it has comments but does require a degree of knowledge of CRM 4.0 plugins. Of course if you know a better way of doing it we'd love to know.
There are plenty of interesting items in this code; such as the fact that by doing it using a plugin (we've also demonstrated this using a workflow and Javascript) it happens on the server; and we've avoided actually downloading the attachment to disk. There are 'catches' such as the name of an attribute changing between create and update.
This plugin needs registering - we use the CRM SDK tools.