When a user logs into your site, use AES_ENCRYPT () to encrypt email.
INSERT into users (email) VALUES (AES_ENCRYPT(' someemail@example.com ', 'aeskey'));
When you query your database, you can call the AES_DECRYPT () function as follows:
SELECT AES_DECRYPT(email, 'aeskey') from users;
source share