Email aggregation: Move bucket id generation into email