String theory in electromagnetic fields