Treat each email as a node. Two emails in the same account are connected. Find connected components.
Use Union-Find. For each account, union all its emails together. After processing all accounts, emails in the same component belong to the same person.
Group emails by their root. The account name comes from any account containing an email in that group (they're all the same person).