Fixing Issue #1821, second try

Well, as you can see, my git-fu is not super fresh. I tried, but the result is *more* commits than the previous one, although it is more focused on fixing issue #1821.

As stated in #1840, I did not implemented this:

`A single function would be preferable I'd think, perhaps with a signature like appendAttachments(string $filename, array $properties). setAttachments would just take an array (or array of arrays) with the keys file, filename and charset.`

I feel like having a keyed array is right. I always prefer to gain flexibility that way. The only thing we must ensure is that those keys are documented.

Please comment and review, this PR will be easier to merge, but I think you should pull #1846 first (which will eliminate the first 3 commits, I think... if not, let me know, I'll try to fix this)