Implement validation of email format

Uses a simple regex, which is far from perfect, but better than nothing.