Fixed issue with sending multiple e-mails

We found an issue with sending multiple e-mails at once in the patch I submitted a couple of days ago. I added a test to confirm the bug and fixed the issue.

Let me know if you need anything changed before you can pull this in!