easydigitaldownloads/Easy-Digital-Downloads — pull request #2541 by leewillis77 (2014-08-27 21:50:16+00:00)
Title: Attachments persistence in EDD_Emails

In my previous commit I fixed up what was there to squash warnings. However, it strikes me that attachments are actually treated incorrectly in the previous code.

Specifically:
1. It's "difficult" to add attachments - you have to wrap add_filter()/remove_filter() around your calls to send() [From reading the code?]
2. It's possible for attachments to "leak" between emails if the same instance of the EDD_Emails class was used to send multiple emails.

The attachments are like "to" and "from" etc. they're specific to an individual invocation of send() and should be treated as such. The attached patch removes any storage of attachments outside of send() and changes the signature of send() to allow passing in of attachment info.

Note: I possibly have another change to make to the signature of send() to support setting of a "heading" to go into the email. I'm also unsure of the impact of these changes on any other related plugins (Email templates or similar)