email: Fix incorrect matching of user ids

Fixes #615