add missing field to group by

I noticed when trying your mail plugin on my dev site that your missing the ID from the "group by" clause in your query.