New on his blog today Andrew Johnstone has a post about email attachments how how the combination of Exim filters and PHP streams can make things much easier for you and your application.
Using exim filters we could add attachments at the delivery stage, therefore reducing overhead in constructing and injecting data into an email. The delivery of emails varied as to whether it was feasible to send as a BCC or whether there were placeholders intended for each individual recipient. As such the following addresses the worst case scenario of attachments with placeholders intended for each individual recipient.
They show how to use a PHP script (that uses streams to pull in the file data and information) hooked into an exim_filter to streamline the attachment process. Configuration file examples are included in the post as well as the PHP source for creating the filter.