Ah the universal failure of understanding from liberals
The First amendment does not "Allow" anything, it is a prohibition on government interfere with a natural right of man with which he was endowed by his Creator as more famously set forth in another document before the current occupant of the White House started editing it in speeches. It also does not allow free speech to be controlled anywhere, that is a distortion caused by activist liberal judges intent on perfecting the morality of man by substituting their own prejudices for established law. In this case for specifically protecting certain people from hearing things which might make them uncomfortable.
Now as to the ruling itself, I think it is ultimately defensible, though not quite so obviously as some people think it ought to be. The key element here is that in general email communications are not encrypted so it is more akin to sending a postcard than a letter. Anyone involved in the handling of the email (postcard) can read what is written on it. If an officer of the law happens to see a postcard while it is being handled in the normal process of delivery, it is not subject to 4th amendment protection because there is no reasonable expectation of privacy. The catch is that law enforcement has essentially demanded to search the post office to see the post cards, which itself does require a search warrant.