1- If you really want to encode the emails, and need to decode them in the future, your best bet is to look at the MySQL encryption functions like ENCODE() and DECODE(). First you need to set up a "salt". This is like a secret code. It can be the same for every record, like this:
SELECT DECODE(email, 'mysecretsalt') FROM Table WHERE id=1
Or, you can make the salt part from a code and another field in the table, like this:
SELECT DECODE(email, CONCAT('mysecretsalt', id)) FROM Table WHERE id=1
2- Set up a specific user in your database that ONLY has access to that specific table and ONLY has INSERT privileges for when you are adding records, and then another user that only has SELECT privileges when you are retrieving the records. Also, lock those users down to the "localhost". If a hacker gets one of those, they can't do much.
Also, when you receive the email from the customer in the form of a request variable (GET or POST), to protect from SQL injection attacks, either escape characters (in PHP, you could use mysqli_real_escape_string()
) or simply get rid of all characters that don't belong. In PHP, it would look like this:
$email = preg_replace('/[^A-Za-z0-9\\.@-_]/', '', $email);
That's the way I like to do it.