Details
Description
When sending mails using the new Mail API from a subwiki, the iteration over the recipient excludes the recipient from another wiki (the main wiki usually) if those users/groups are not already in the document cache.
Those excluded users/groups are also badly loaded into the document cache, which could lead to other unexpected side effects (missing profile, unrecognized user, empty groups, ...)
The cause to this issue is linked to the usage of an inappropriate XWikiContext while loading the user/group documents.