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.
Messaging.EmailFileAttachment fileAttachment = new Messaging.EmailFileAttachment();
allAttachments[i] = fileAttachment;
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.