Better checking for valid email addresses

Still has a couple of awful crashes though... At least the memory corruption
seems to be gone..