Carol at 6FU reported that, despite her being in a community, she wasn't allowed to email in. Chris did some research.
Mailin figures gets the profile of an email's author by getting the profiles folder and calling profiles.getProfileByEmail(), which in turn relies on a datastructure on the profiles folder, an OOBTree, email_to_name, which is used as a local index for looking up a user's id given their email address. The email_to_name structure is updated in an event handler, models.subscribers.profile_added, which is registered for IObjectAddedEvent and IObjectModifiedEvent. Although, I haven't fully traced the code, there must exist a path through the code where you can add a profile without triggering one of those events (or trigger it before the email is set on the profile). When I looked just now, we had 6032 profiles but only 5739 entries in the email_to_name index, so obviously we're out of sync.
So, what I've done is I've compiled a list of all of the users who were not in the index and saved out to disk so that we can go back and refer it to later, in case we want to search for a pattern there. I've also gone ahead and rebuilt the email_to_name index by hand, so it is now up to date. This means Carol, among others, should now be able to post to Karl via mailin. This has also led me to my next sad discovery. The size of the index after rebuilding it was still only 5937 entries. It turns out the reason for *that* is there are multiple profiles with the same email addresses. So for those users with more than one Karl profile, it is now a crapshoot which of their profiles wound up in the index. This, obviously, has implications for mailin behaving sanely.
So, to sum up:
1) Carol can emailin to Karl.
2) We need to figure out how/why multiple profiles can share the same email address and what we should do about that.
3) We need to figure out why the email_to_name index gets out of sync and fix that.
Let's at least look at this next week and decide to either call the janitor and clean it up, or wontfix it.