These notes assume you know how to work with the Messaging.SingleEmailMessage class. If anybody has a better way of doing this, let me know.
While building an APEX class that emails Case Owner, boss wanted to add the last few attachments of a Case to the email being generated.
1.) Instantiate SingleEmailMessage object:
2.) Query Attachments of whatever object type you want attachments
on. I return the results to an Attachment[] array. Note - this is a
good place to limit the number of attachments you want to return.
3.) Create an EmailFileAttachment[] array to hold each file, loop through the query and populate the array.
for(integer i=0;i<queryAttachment.size();i++)
{
Messaging.EmailFileAttachment fileAttachment = new Messaging.EmailFileAttachment();
fileAttachment.setBody(queryAttachment[i].Body);
fileAttachment.setFileName(queryAttachment[i].Name);
allAttachments[i] = fileAttachment;
} Messaging.EmailFileAttachment[queryAttachment.size()];
4.) Now that our allAttachments array is populated, pass allAttachments to your mail object's setFileAttachments method:
5.) Do the rest of your mail.methods to generate and send your email.
http://blog.psychopup.net/post/2009/10/15/Adding-Attachments-to-emails-via-APEX-in-Salesforce.aspx