Fixes the bug of sending an e-mail notification only to the owner of the...

... event. Also allows to send e-mail notifications to the members of groups that are shared with. Also checks that each recipient gets the e-mail only once, even if it belongs to several groups, for instance.
OK, I've checked it, corrected it on my server too, it works fine, and in addition I noticed I made an error in this commit (the line right above, 553, should not be there). I will create a new commit correcting this and pull a new request. This one can be removed.